Encoding device, decoding device, encoding method, and decoding method

ABSTRACT

According to an embodiment, an encoding device includes an index setting unit and an encoding unit. The index setting unit generates a common index in which reference indices of one or more reference images included in a first index and a second index are sorted in a combination so as not to include a same reference image in accordance with a predetermined scanning order. The first index representing a combination of the one or more reference images referred to by a first reference image. The second index representing a combination of the one or more reference images referred to by a second reference image. The encoding unit encodes the common index.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation application of U.S. application Ser.No. 14/799,253 filed Jul. 14, 2015, which is a continuation applicationof U.S. application Ser. No. 14/028,024 filed Sep. 16, 2013, which is acontinuation of PCT international Application Ser. No.PCT/JP2011/073851, filed on Oct. 17, 2011, which designates the UnitedStates; the entire contents of which are incorporated herein byreference.

FIELD

Embodiments described herein relate generally to an encoding method anda decoding method.

BACKGROUND

In recent years, a method of encoding an image with markedly improvedcoding efficiency is recommended as ITU-T REC. H.264 and ISO/IEC14496-10 (hereinafter, referred to as “H.264”) in cooperation of ITU-T(International Telecommunication Union Telecommunication StandardizationSector) and ISO (International Organization for Standardization)/IEC(International Electrotechnical Commission).

In H.264, an inter-prediction coding system is disclosed in whichredundancy in the time direction is eliminated to achieve high codingefficiency by making a motion compensation prediction of fractionalprecision using a coded image as a reference image.

In addition, a system is proposed in which a moving image including afading or dissolving effect is encoded with efficiency higher than thatof an inter-prediction coding system according to ISO/IEC MPEG (MovingPicture Experts Group)-1, 2, 4. In this system, a motion compensationprediction of fractional precision is made for an input moving imagehaving luminance and two color differences as frames for predicting achange in the brightness in the time direction. Then, by using an indexrepresenting a combination of a reference image, a weighting factor foreach luminance and two color differences, and an offset for eachluminance and two color differences, a predicted image is multiplied bythe weighting factor, and the offset is added thereto.

However, in the technology of the related art as described above, in abidirectional prediction slice in which bi-directional predictions canbe selected, when weighted motion compensation is performed using twoindices having the same reference image but having different referenceimage numbers different from each other, there are cases where an indexhaving the same value is encoded twice, and accordingly, there are caseswhere the coding efficiency decreases. An object of the presentinvention is to provide an encoding method and a decoding method capableof improving the coding efficiency.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram that illustrates an example of an encodingdevice according to a first embodiment;

FIG. 2 is an explanatory diagram that illustrates an example of apredicted coding sequence for a pixel block according to the firstembodiment;

FIG. 3A is a diagram that illustrates an example of the size of a codingtree block according to the first embodiment;

FIG. 3B is a diagram that illustrates a specific example of the codingtree block according to the first embodiment;

FIG. 3C is a diagram that illustrates another specific example of thecoding tree block according to the first embodiment;

FIG. 3D is a diagram that illustrates another specific example of thecoding tree block according to the first embodiment;

FIG. 4 is a block diagram that illustrates an example of a predictedimage generating unit according to the first embodiment;

FIG. 5 is a diagram that illustrates an example of the relation betweenmotion vectors for a motion-compensated prediction in a bidirectionalprediction according to the first embodiment;

FIG. 6 is a block diagram that illustrates an example of a multi-framemotion compensation unit according to the first embodiment;

FIG. 7 is an explanatory diagram that illustrates an example of fixedpoint precision of a weighting factor according to the first embodiment;

FIG. 8 is a block diagram that illustrates an example of an indexsetting unit according to the first embodiment;

FIG. 9A is a diagram that illustrates an example of WP parameterinformation according to the first embodiment;

FIG. 9B is a diagram that illustrates an example of WP parameterinformation according to the first embodiment;

FIG. 10 is a diagram that illustrates an example of an encoding orderand a display order in a low-delay encoding structure according to thefirst embodiment;

FIG. 11 is a diagram that illustrates an example of the relation betweena reference image and a reference number in the low-delay encodingstructure according to the first embodiment;

FIG. 12 is a diagram that illustrates an example of an encoding orderand a display order in a random access encoding structure according tothe first embodiment;

FIG. 13 is a diagram that illustrates an example of the relation betweena reference image and a reference number in the random access encodingstructure according to the first embodiment;

FIG. 14 is a diagram that illustrates an example of the scanning orderof a list number and a reference number of a reference image accordingto the first embodiment;

FIG. 15 is a diagram that illustrates an example of the WP parameterinformation after a common list conversion according to the firstembodiment in a simplified manner;

FIG. 16 is diagram that illustrates an example of the WP parameterinformation after a common list conversion according to the firstembodiment in a simplified manner;

FIG. 17 is a flowchart that illustrates an example of the process ofgenerating index information according to the first embodiment;

FIG. 18 is a diagram that illustrates an example of syntax according tothe first embodiment;

FIG. 19 is a diagram that illustrates an example of picture parameterset syntax according to the first embodiment;

FIG. 20 is a diagram that illustrates slice header syntax according tothe first embodiment;

FIG. 21 is a diagram that illustrates an example of pred weight tablesyntax according to the first embodiment.

FIG. 22 is a diagram that illustrates an example of sequence parameterset syntax according to a modification;

FIG. 23 is a diagram that illustrates an example of adaptation parameterset syntax according to a modification;

FIG. 24 is a diagram that illustrates an example of a pred weight tablesyntax according to a modification;

FIG. 25 is a block diagram that illustrates an example of theconfiguration of an index setting unit according to a second embodiment;

FIG. 26 is a flowchart that illustrates an example of the process ofgenerating index information according to the second embodiment;

FIG. 27 is a diagram that illustrates an example of pred weight tablesyntax according to the second embodiment;

FIG. 28 is a block diagram that illustrates an example of theconfiguration of an encoding device according to a third embodiment;

FIG. 29 is a diagram that illustrates a detailed example of motioninformation memory according to the third embodiment;

FIG. 30A is a diagram that illustrates an example of block positions atwhich motion information candidates are derived for an encoding pixelblock according to the third embodiment;

FIG. 30B is a diagram that illustrates an example of a block position atwhich a motion information candidate is derived for an encoding pixelblock according to the third embodiment;

FIG. 31 is a diagram that illustrates an example of the relation betweenpixel block positions of a plurality of motion information candidatesand pixel block position indices according to the third embodiment;

FIG. 32 is a flowchart that illustrates an example of a storage processfor MergeCandList according to the third embodiment;

FIG. 33 is a diagram that illustrates an example of a storage list ofmotion information according to the third embodiment;

FIG. 34 is a flowchart that illustrates an example of a method ofstoring motion information in the storage list according to the thirdembodiment;

FIG. 35 is a diagram that illustrates an example of a combination of abidirectional prediction according to the third embodiment;

FIG. 36 is a diagram that illustrates an example of pred unit syntaxaccording to the third embodiment;

FIG. 37 is a flowchart that illustrates another example of the storageprocess for MergeCandList according to the third embodiment;

FIG. 38 is a block diagram that illustrates an example of theconfiguration of a decoding device according to a fourth embodiment;

FIG. 39 is a block diagram that illustrates an example of theconfiguration of an index setting unit according to the fourthembodiment;

FIG. 40 is a block diagram that illustrates an example of theconfiguration of an index setting unit according to a fifth embodiment;

FIG. 41 is a block diagram that illustrates an example of theconfiguration of a decoding device according to a sixth embodiment; and

FIG. 42 is a view illustrating a hardware configuration of the deviceaccording to each embodiment.

DETAILED DESCRIPTION

According to an embodiment, an encoding device includes an index settingunit and an encoding unit. The index setting unit generates a commonindex in which reference indices of one or more reference imagesincluded in a first index and a second index are sorted in a combinationso as not to include a same reference image in accordance with apredetermined scanning order. The first index representing a combinationof the one or more reference images referred to by a first referenceimage. The second index representing a combination of the one or morereference images referred to by a second reference image. The encodingunit encodes the common index.

Hereinafter, embodiments will be described in detail with reference tothe accompanying drawings. An encoding device and a decoding deviceaccording to each embodiment presented below may be implemented byhardware such as an LSI (Large-Scale Integration) chip, a DSP (DigitalSignal Processor), or an FPGA (Field Programmable Gate Array). Inaddition, an encoding device and a decoding device according to eachembodiment presented below may be implemented by causing a computer toexecute a program, in other words, by software. In description presentedbelow, a term “image” may be appropriately replaced by a term such as a“video”, a “pixel”, an “image signal”, a “picture”, or “image data”.

First Embodiment

In a first embodiment, an encoding device encoding a moving image willbe described.

FIG. 1 is a block diagram that illustrates an example of theconfiguration of an encoding device 100 according to a first embodiment.

The encoding device 100 divides each frame or each field configuring aninput image into a plurality of pixel blocks and performs predictedencoding of the divided pixel blocks using encoding parameters inputfrom an encoding control unit 111, thereby generating a predicted image.Then, the encoding device 100 generates a prediction error bysubtracting the predicted image from the input image divided into theplurality of pixel blocks, generates encoded data by performingorthogonal transformation, and quantization, and then entropy encodingfor the generated prediction error, and outputs the generated encodeddata.

The encoding device 100 performs predicted encoding by selectivelyapplying a plurality of prediction modes that are different from eachother in at least one of the block size of the pixel block and themethod of generating a predicted image. The method of generating apredicted image can be largely divided into two types including anintra-prediction in which a prediction is made within an encoding targetframe and an inter-prediction in which a motion-compensated predictionis made using one or more reference frames of different time points. Theintra-prediction is also called an internal-screen prediction, aninternal-frame prediction, or the like, and the inter-prediction is alsocalled an inter-screen prediction, an inter-frame prediction, amotion-compensated prediction, or the like.

FIG. 2 is an explanatory diagram that illustrates an example of apredicted coding sequence for a pixel block according to the firstembodiment. In the example illustrated in FIG. 2, the encoding device100 performs prediction encoding from the upper left side toward thelower right side in the pixel block. Thus, in an encoding processingtarget frame f, on the left side and the upper side of the encodingtarget pixel block c, pixel blocks p that have been completed to beencoded are located. Hereinafter, for the simplification of description,while it is assumed that the encoding device 100 performs predictionencoding in order illustrated in FIG. 2, the order in the predictedencoding is not limited thereto.

The pixel block represents a unit for processing an image and, forexample, a block having an M×N size (here, M and N are natural numbers),a coding tree block, a macro block, a sub-block, one pixel, or the likecorresponds thereto. In description presented below, basically, thepixel block is used as the meaning of a coding tree block but may beused as a different meaning. For example, in description of a predictionunit, a pixel block is used as the meaning of a pixel block of theprediction unit. A block may be referred to as a unit or the like. Forexample, a coding block may be referred to as a coding unit.

FIG. 3A is a diagram that illustrates an example of the size of a codingtree block according to the first embodiment. The coding tree block,typically, is a pixel block of 64×64 as illustrated in FIG. 3A. However,the coding tree block is not limited thereto but may be a pixel block of32×32, a pixel block of 16×16, a pixel block of 8×8, a pixel block of4×4, or the like. Here, the coding tree block may not be a square but,for example, may be a pixel block of an M×N size (here, M N).

FIGS. 3B to 3D are diagrams representing specific examples of the codingtree block according to the first embodiment. FIG. 3B represents acoding tree block having a size of 64×64 (N=32). Here, N represents thesize of a reference coding tree block. The size of a case where thecoding tree block is divided is defined as N, and the size of a casewhere the coding tree block is not divided is defined as 2N. FIG. 3Crepresents a coding tree block acquired by dividing the coding treeblock illustrated in FIG. 3B into a quadtree. The coding tree block, asillustrated in FIG. 3C, has a quadtree structure. In a case where thecoding tree block is divided, as illustrated in FIG. 3C, numbers areattached to four pixel blocks after division in the Z scanning order.

In addition, within each number of the quadtree, the coding tree blockmay be further divided into a quadtree. Accordingly, the coding treeblock may be divided in a hierarchical manner. In such a case, the depthof the division is defined as Depth. FIG. 3D represents one of thecoding tree blocks acquired by dividing the coding tree blockillustrated in FIG. 3B into a quadtree, and the block size thereof is32×32 (N=16). The depth of the coding tree block illustrated in FIG. 3Bis “0”, and the depth of the coding tree block illustrated in FIG. 3D is“1”. In addition, a coding tree block having a largest unit is called alarge coding tree block, and an input image signal is encoded in such aunit in the raster scanning order.

In the description presented below, the encoded target block or thecoding tree block of an input image may be referred to as a predictiontarget block or a prediction pixel block. In addition, the encoding unitis not limited to the pixel block, but at least one of a frame, a field,a slice, a line, and a pixel may be used as the encoding unit.

The encoding device 100, as illustrated in FIG. 1, includes: asubtraction unit 101; an orthogonal transformation unit 102; aquantization unit 103; an inverse quantization unit 104; an inverseorthogonal transformation unit 105; an addition unit 106; a predictedimage generating unit 107; an index setting unit 108; a motionevaluating unit 109; and an encoding unit 110. In addition, the encodingcontrol unit 111 illustrated in FIG. 1 controls the encoding device 100and, for example, may be implemented by using a CPU (Central ProcessingUnit) or the like.

The subtraction unit 101 acquires a prediction error by subtracting acorresponding predicted image from an input image divided into pixelblocks. The subtraction unit 101 outputs the prediction error so as tobe input to the orthogonal transformation unit 102.

The orthogonal transformation unit 102 performs an orthogonaltransformation such as a discrete cosine transform (DCT) or a discretesine transform (DST) for the prediction error input from the subtractionunit 101, thereby acquiring a transformation coefficient. The orthogonaltransformation unit 102 outputs the transformation coefficient so as tobe input to the quantization unit 103.

The quantization unit 103 performs a quantization process for thetransformation coefficient input from the orthogonal transformation unit102, thereby acquiring a quantization transformation coefficient. Morespecifically, the quantization unit 103 performs quantization based on aquantization parameter designated by the encoding control unit 111 andquantization information such as a quantization matrix. Described inmore detail, the quantization unit 103 acquires the quantizationtransformation coefficient by dividing the transformation coefficient bya quantization step size derived based on the quantization information.The quantization parameter represents the fineness of the quantization.The quantization matrix is used for weighting the fineness of thequantization for each component of the transformation coefficient. Thequantization unit 103 outputs the quantization transformationcoefficient so as to be input to the inverse quantization unit 104 andthe encoding unit 110.

The inverse quantization unit 104 performs an inverse quantizationprocess for the quantization transformation coefficient input from thequantization unit 103, thereby acquiring a restoration transformationcoefficient. More specifically, the inverse quantization unit 104performs inverse quantization based on the quantization information usedby the quantization unit 103. Described in detail, the inversequantization unit 104 acquires a restoration transformation coefficientby multiplying the quantization transformation coefficient by thequantization step size derived based on the quantization information. Inaddition, the quantization information used by the quantization unit 103is loaded from internal memory, which is not illustrated in the figure,of the encoding control unit 111 and is used. The inverse quantizationunit 104 outputs the restoration transformation coefficient so as to beinput to the inverse orthogonal transformation unit 105.

The inverse orthogonal transformation unit 105 performs an inverseorthogonal transformation such as an inverse discrete cosine transform(IDCT) or an inverse discrete sine transform (IDST) for the restorationtransformation coefficient input from the inverse quantization unit 104,thereby acquiring a restoration prediction error. Here, the inverseorthogonal transformation performed by the inverse orthogonaltransformation unit 105 corresponds to an orthogonal transformationperformed by the orthogonal transformation unit 102. The inverseorthogonal transformation unit 105 outputs the restoration predictionerror so as to be input to the addition unit 106.

The addition unit 106 adds the restoration prediction error input fromthe inverse orthogonal transformation unit 105 and a correspondingpredicted image, thereby generating a local decoded image. The additionunit 106 outputs the local decoded image so as to be input to thepredicted image generating unit 107.

The predicted image generating unit 107 stores the local decoded imageinput from the addition unit 106 in memory (not illustrated in FIG. 1)as a reference image and outputs the reference image stored in thememory so as to be input to the motion evaluating unit 109. In addition,the predicted image generating unit 107 generates a predicted image byperforming a weighted motion-compensated prediction based on the motioninformation and WP parameter information input from the motionevaluating unit 109. The predicted image generating unit 107 outputs thepredicted image so as to be input to the subtraction unit 101 and theaddition unit 106.

FIG. 4 is a block diagram that illustrates an example of theconfiguration of the predicted image generating unit 107 according tothe first embodiment. The predicted image generating unit 107, asillustrated in FIG. 4, includes: a multi-frame motion compensation unit201; a memory 202; a single-directional motion compensation unit 203; aprediction parameter control unit 204; a reference image selector 205; aframe memory 206; and a reference image control unit 207.

The frame memory 206 stores the local decoded image input from theaddition unit 106 as a reference image under the control of thereference image control unit 207. The frame memory 206 includes aplurality of memory sets FM1 to FMN (here, N≧2) used for temporarilystoring the reference image.

The prediction parameter control unit 204 prepares a plurality ofcombinations a reference image number and a prediction parameter as atable based on the motion information input from the motion evaluatingunit 109. Here, the motion information represents information of amotion vector representing the deviation of a motion that is used forthe motion-compensated prediction, the reference image number, and aprediction mode such as a single-directional/bidirectional prediction.The prediction parameter represents information relating to the motionvector and the prediction mode. Then, the prediction parameter controlunit 204 selects a combination of a reference number and a predictionparameter used for generating a predicted image based on the input imageand outputs the selected combination so as to allow the reference imagenumber to be input to the reference image selector 205 and allow theprediction parameter to be input to the single-directional motioncompensation unit 203.

The reference image selector 205 is a switch that changes one of outputterminals of the frame memories FM1 to FMN, which are included in theframe memory 206, to be switched to based on a reference image numberinput from the prediction parameter control unit 204. For example, whenthe reference image number is “0”, the reference image selector 205connects the output terminal of the frame memory FM1 to the outputterminal of the reference image selector 205, and, when the referenceimage number is N−1, the reference image selector 205 connects theoutput terminal of the frame memory FMN to the output terminal of thereference image selector 205. The reference image selector 205 outputs areference image stored in the frame memory of which the output terminalis connected thereto from among the frame memories FM1 to FMN includedin the frame memory 206 so as to be input to the single-directionalmotion compensation unit 203 and the motion evaluating unit 109.

The single-directional predicted motion compensation unit 203 performs amotion-compensated prediction process based on the prediction parameterinput from the prediction parameter control unit 204 and the referenceimage input from the reference image selector 205, thereby generating asingle-directional predicted image.

FIG. 5 is a diagram that illustrates an example of the relation betweenmotion vectors for a motion-compensated prediction in a bidirectionalprediction according to the first embodiment. In the motion-compensatedprediction, an interpolation process is performed using the referenceimage, and a single-directional predicted image is generated based ondeviations of motions of the generated interpolated image and the inputimage from the pixel block located at the encoding target position.Here, the deviation is a motion vector. As illustrated in FIG. 5, in thebidirectional prediction slice (B-slice), a predicted image is generatedby using two types of reference images and a motion vector set. As theinterpolation process, an interpolation process of ½-pixel precision, aninterpolation process of ¼-pixel precision, or the like is used, and, byperforming a filtering process for the reference image, a value of theinterpolated image is generated. For example, in H.264 in which aninterpolation up to ¼-pixel precision can be performed for a luminancesignal, the deviation is represented as four times integer pixelprecision.

The single-directional predicted motion compensation unit 203 outputs asingle-directional predicted image and temporarily stores thesingle-directional predicted image in the memory 202. Here, in a casewhere the motion information (prediction parameter) represents abi-directional prediction, the multi-frame motion compensation unit 201makes a weighted prediction using two types of single-directionalpredicted images. Accordingly, the single-directional predicted motioncompensation unit 203 stores a single-directional predicted imagecorresponding to the first type in the single-directional predictedimage in the memory 202 and directly outputs a single-directionalpredicted image corresponding to the second type to the multi-framemotion compensation unit 201. Here, the single-directional predictedimage corresponding to the first type will be referred to as a firstpredicted image, and the single-directional predicted imagecorresponding to the second type will be referred to as a secondpredicted image.

In addition, two single-directional motion compensation units 203 may beprepared and generate two single-directional predicted images. In such acase, when the motion information (prediction parameter) represents asingle-directional prediction, the single-directional motioncompensation unit 203 may directly output the first single-directionalpredicted image to the multi-frame motion compensation unit 201 as afirst predicted image.

The multi-frame motion compensation unit 201 makes a weighted predictionby using the first predicted image input from the memory 202, the secondpredicted image input from the single-directional predicted motioncompensation unit 203, and the WP parameter information input from themotion evaluating unit 109, thereby generating a predicted image. Themulti-frame motion compensation unit 201 outputs the predicted image soas to be input to the subtraction unit 101 and the addition unit 106.

FIG. 6 is a block diagram that illustrates an example of theconfiguration of the multi-frame motion compensation unit 201 accordingto the first embodiment. As illustrated in FIG. 6, the multi-framemotion compensation unit 201 includes: a default motion compensationunit 301; a weighted motion compensation unit 302; a WP parametercontrol unit 303; and WP selectors 304 and 305.

The WP parameter control unit 303 outputs a WP application flag andweighting information based on the WP parameter information input fromthe motion evaluating unit 109 so as to input the WP application flag tothe WP selectors 304 and 305 and input the weighting information to theweighted motion compensation unit 302.

Here, the WP parameter information includes information of the fixedpoint precision of the weighting factor, a first WP application flag, afirst weighting factor, and a first offset corresponding to the firstpredicted image, and a second WP application flag, a second weightingfactor, and a second offset corresponding to the second predicted image.The WP application flag is a parameter that can be set for eachcorresponding reference image and signal component and representswhether or not a weighted motion compensation prediction is made. Theweighting information includes information of the fixed point precisionof the weighting factor, the first weighting factor, the first offset,the second weighting factor, and the second offset.

Described in detail, when the WP parameter information is input from themotion evaluating unit 109, the WP parameter control unit 303 outputsthe WP parameter information with being divided into the first WPapplication flag, the second WP application flag, and the weightinginformation, thereby inputting the first WP application flag to the WPselector 304, inputting the second WP application flag to the WPselector 305, and inputting the weighting information to the weightedmotion compensation unit 302.

The WP selectors 304 and 305 change the connection ends of the predictedimages based on the WP application flags input from the WP parametercontrol unit 303. In a case where the corresponding WP application flagis “0”, each one of the WP selectors 304 and 305 connects the output endthereof to the default motion compensation unit 301. Then, the WPselectors 304 and 305 output the first and second predicted images so asto be input to the default motion compensation unit 301. On the otherhand, in a case where the corresponding WP application flag is “1”, eachone of the WP selectors 304 and 305 connects the output end thereof tothe weighted motion compensation unit 302. Then, the WP selectors 304and 305 output the first and second predicted images so as to be inputto the weighted motion compensation unit 302.

The default motion compensation unit 301 performs average processingbased on the two single-directional predicted images (the first andsecond predicted images) input from the WP selectors 304 and 305,thereby generating a predicted image. More specifically, in a case wherethe first and second WP application flags are “0”, the default motioncompensation unit 301 performs average processing based on NumericalExpression (1).

P[x,y]=Clip1((PL0[x,y]+PL1[x,y]+offset2)>>(shift2))  (1)

Here, P[x, y] is a predicted image, PL0[x, y] is a first predictedimage, and PL1[x, y] is a second predicted image. In addition, offset2and shift2 are parameters of a rounding process in the averageprocessing and are determined based on the internal calculationprecision of the first and second predicted images. When the bitprecision of the predicted image is L, and the bit precision of thefirst and second predicted images is M (L≦M), shift2 is formulated byNumerical Expression (2), and offset2 is formulated by NumericalExpression (3).

shift2=(M−L+1)  (2)

offset2=(1<<(shift2−1)  (3)

For example, the bit precision of the predicted image is “8”, and thebit precision of the first and second predicted images is “14”, shift2=7based on Numerical Expression (2), and offset2=(1<<6) based on NumericalExpression (3).

In addition, in a case where the prediction mode represented by themotion information (prediction parameter) is the single-directionalprediction, the default motion compensation unit 301 calculates a finalpredicted image using only the first predicted image based on NumericalExpression (4).

P[x,y]=Clip1((PLX[x,y]+offset1)>>(shift1))   (4)

Here, PLX[x, y] represents a single-directional predicted image (firstpredicted image), and X is an identifier representing either “0” or “1”as a reference list. For example, PLX[x, y] is PL0[x, y] in a case wherethe reference list is “0” and is PL1[x, y] in a case where the referencelist is “1”. In addition, offset1 and shift1 are parameters for arounding process and are determined based on the internal calculationprecision of the first predicted image. When the bit precision of thepredicted image is L, and the bit precision of the first predicted imageis M, shift1 is formulated by Numerical Expression (5), and offset1 isformulated by Numerical Expression (6).

shift1=(M−L)  (5)

offset1=(1<<(shift1−1)  (6)

For example, in a case where the bit precision of the predicted image is“8”, and the bit precision of the first predicted image is “14”,shift1=6 based on Numerical Expression (5), and offset1=(1<<5) based onNumerical Expression (6).

The weighted motion compensation unit 302 performs weighted motioncompensation based on the two single-directional predicted images (thefirst and second predicted images) input from the WP selectors 304 and305 and the weighting information input from the WP parameter controlunit 303. More specifically, the weighted motion compensation unit 302performs the weighting process based on Numerical Expression (7) in acase where the first and second WP application flags are “1”.

P[x,y]=Clip1(((PL0[x,y]*w _(0C) +PL1 [x,y]*w _(1C)+(1<<log WD_(C)))>>(log WD _(C)+1))+((o _(0C) +o _(1C)+1)>>1))  (7)

Here, w_(0C) represents a weighting factor corresponding to the firstpredicted image, w_(1C) represents a weighting factor corresponding tothe second predicted image, o_(0C) represents an offset corresponding tothe first predicted image, and o_(1C) represents an offset correspondingto the second predicted image. Thereafter, they will be referred to as afirst weighting factor, a second weighting factor, a first offset, and asecond offset. log WD_(C) is a parameter representing fixed pointprecision of each weighting factor. In addition, a variable C representsa signal component. For example, in the case of a YUV spatial signal, aluminance signal is represented by C=Y, a Cr color difference signal isrepresented by C=Cr, and a Cb color difference component is representedby C=Cb.

In addition, in a case where the calculation precision of the first andsecond predicted images and the calculation precision of the predictedimage are different from each other, the weighted motion compensationunit 302 realizes a rounding process by controlling log WD_(C), which isfixed point precision, as in Numerical Expression (8).

log WD′ _(C)=log WD _(C)+offset1  (8)

The rounding process can be realized by replacing log WD_(C) representedin Numerical Expression (7) with log WD_(C) represented in NumericalExpression (8). For example, in a case where the bit precision of thepredicted image is “8”, and the bit precision of the first and secondpredicted images is “14”, by resetting log WD_(C), it is possible torealize a batch rounding process for the calculation precision similarto that of shift2 represented in Numerical Expression (1).

In addition, in a case where the prediction mode represented by themotion information (prediction parameter) is a single directionalprediction, the weighted motion compensation unit 302 calculates a finalpredicted image using only the first predicted image based on NumericalExpression (9).

P[x,y]=Clip1((PLX[x,y]′w _(XC)+(1<<log WD _(C)−1))>>(log WD _(C)))  (9)

Here, PLX[x, y] represents a single-directional predicted image (firstpredicted image), w_(XC) represents a weighting factor corresponding tothe single directional prediction, and X is an identifier representingeither “0” or “1” as a reference list. For example, PLX[x, y] and w_(XC)are PL0[x, y] and w_(0C) in a case where the reference list is “0” andare PL1[x, y] and w_(1C) in a case where the reference list is “1”.

In addition, in a case where the calculation precision of the first andsecond predicted images and the calculation precision of the predictedimage are different from each other, the weighted motion compensationunit 302 realizes a rounding process by controlling log WD_(C), which isfixed point precision, as in Numerical Expression (8), similarly to thecase of the bi-directional prediction.

The rounding process can be realized by replacing log WD_(C) representedin Numerical Expression (7) with log WD′_(C) represented in NumericalExpression (8). For example, in a case where the bit precision of thepredicted image is “8”, and the bit precision of the first and secondpredicted images is “14”, by resetting log WD_(C), it is possible torealize a batch rounding process for the calculation precision similarto that of shift1 represented in Numerical Expression (4).

FIG. 7 is an explanatory diagram that illustrates an example of fixedpoint precision of a weighting factor according to the first embodimentand is a diagram that illustrates an example of changes in a movingimage having a brightness change in the time direction and a gray scalevalue. In the example illustrated in FIG. 7, an encoding target frame isFrame(t), a frame that is one frame before the encoding target frame intime is Frame(t−1), and a frame that is one frame after the encodingtarget frame in time is Frame(t+1). As illustrated in FIG. 7, in afading image changing from white to black, the brightness (gray scalevalue) of the image decreases in accordance with elapse of time. Theweighting factor represents the degree of change in FIG. 7, and, as isapparent from Numerical Expressions (7) and (9), takes a value of “1.0”in a case where there is no change in the brightness. The fixed pointprecision is a parameter controlling an interval width corresponding toa decimal point of the weighing factor, and the weighting factor is1<<log WD_(C) in a case where there is no change in brightness.

In addition, in the case of a single directional prediction, variousparameters (the second WP application flag, the second weighting factor,and the second offset information) corresponding to the second predictedimage are not used and may be set to initial values determined inadvance.

Referring back to FIG. 1, the motion evaluating unit 109 performs amotion evaluation between a plurality of frames based on an input imageand a reference image input from the predicted image generating unit 107and outputs the motion information and the WP parameter information,thereby inputting the motion information to the predicted imagegenerating unit 107 and the encoding unit 110 and inputting the WPparameter information to the predicted image generating unit 107 and theindex setting unit 108.

The motion evaluating unit 109 calculates an error, for example, bycalculating differences between an input image of a prediction targetpixel block and a plurality of reference images corresponding to thesame position as a starting point, shifts the position with fractionalprecision, and calculates optimal motion information using a techniquesuch as block matching for finding a block of a minimal error or thelike. In the case of a bi-directional prediction, the motion evaluatingunit 109 performs block matching including a default motion compensationprediction as represented in Numerical Expressions (1) and (4) using themotion information derived from the single-directional prediction,thereby calculating motion information of the bidirectional prediction.

At this time, the motion evaluating unit 109 can calculate the WPparameter information by performing block matching including a weightedmotion compensation prediction as represented in Numerical Expressions(7) and (9). In addition, for the calculation of the WP parameterinformation, a method of calculating a weighting factor or an offsetusing a brightness gradient of the input image, a method of calculatinga weighting factor or an offset in accordance with the accumulation of aprediction error at the time of encoding, or the like may be used.Furthermore, as the WP parameter information, a fixed value determinedin advance for each encoding device may be used.

Here, a method of calculating a weighting factor, the fixed pointprecision of the weighting factor, and an offset from a moving imagehaving a brightness change in time will be described with reference toFIG. 7. As described above, in the fading image changing from white toblack as illustrated in FIG. 7, the brightness (gray scale value) of theimage decreases in accordance with the elapse of time. The motionevaluating unit 109 can calculate the weighting factor by calculatingthe slope thereof.

The fixed point precision of the weighting factor is informationrepresenting the precision of the slope, and the motion evaluating unit109 can calculate an optimal value based on a distance to the referenceimage in time and the degree of change of the image brightness. Forexample, in FIG. 7, in a case where the weighting factor betweenFrame(t−1) and Frame(t+1) is 0.75 with fractional precision, ¾ can berepresented in the case of ¼ precision, and accordingly, the motionevaluating unit 109 sets the fixed point precision to 2 (1<<2). Sincethe value of the fixed point precision influences on the code amount ofa case where the weighting factor is encoded, as the value of the fixedpoint precision, an optimal value may be selected in consideration ofthe code amount and the prediction precision. In addition, the value ofthe fixed point precision may be a fixed value determined in advance.

In addition, in a case where the slope is not matched, the motionevaluating unit 109 can calculate the value of the offset by acquiring acorrection value (deviation amount) corresponding to the intercept ofthe linear function. For example, in FIG. 7, in a case where a weighingfactor between Frame(t-1) and Frame(t+1) is 0.60 with decimal pointprecision, and the fixed point precision is “1” (1<<1), there is a highpossibility that the weighting factor is set to “1” (corresponding todecimal point precision of 0.50 of the weighting factor). In such acase, since the decimal point precision of the weighting factor deviatesfrom 0.60, which is an optimal value, by 0.10, the motion evaluatingunit 109 calculates a correction value corresponding thereto based on amaximum value of the pixel and is set as the value of the offset. In acase where the maximum value of the pixel is 255, the motion evaluatingunit 109 may set a value such as 25 (255×0.1).

In the first embodiment, although the motion evaluating unit 109 isrepresented as one function of the encoding device 100 as an example,the motion evaluating unit 109 is not an essential configuration of theencoding device 100, and, for example, the motion evaluating unit 109may be a device other than the encoding device 100. In such a case, themotion information and the WP parameter information calculated by themotion evaluating unit 109 may be loaded into the encoding device 100.

The index setting unit 108 receives the WP parameter information inputfrom the motion evaluating unit 109, checks a reference list (listnumber) and a reference image (reference number), and outputs indexinformation so as to be input to the index setting unit 108.

FIG. 8 is a block diagram that illustrates an example of theconfiguration of the index setting unit 108 according to the firstembodiment. The index setting unit 108, as illustrated in FIG. 8,includes a reference image checking unit 401 and an index generatingunit 402.

The reference image checking unit 401 receives the WP parameterinformation input from the motion evaluating unit 109 and checks whetheror not there are WP parameters representing a reference image having thesame reference number included in two reference lists. Then, thereference image checking unit 401 removes the WP parameter representingthe same reference image included in the WP parameter information andoutputs the WP parameter information after removal so as to be input tothe index generating unit 402.

The index generating unit 402 receives the WP parameter information inwhich the redundant WP parameter has been removed from the referenceimage checking unit 401 and generates index information by mapping theWP parameter information into a syntax element to be described later.The index generating unit 402 outputs the index information so as to beinput to the encoding unit 110.

FIGS. 9A and 9B are diagrams illustrating examples of the WP parameterinformation according to the first embodiment. An example of the WPparameter information at the time of P-slice is as illustrated in FIG.9A, and an example of the WP parameter information at the time ofB-slice is as illustrated in FIGS. 9A and 9B. A list number is anidentifier representing a prediction direction. The list number has avalue of “0” in the case of a single-directional prediction. On theother hand, in the case of a bi-directional prediction, two types ofprediction can be used, and accordingly, the list number has two valuesof “0” and “1”. A reference number is a value corresponding to any oneof 1 to N represented in the frame memory 206. Since the WP parameterinformation is maintained for each reference list and reference image,in a case where there are N reference images, 2N pieces of informationare necessary at the time of B-slice. The reference image checking unit401 reconverts the WP parameter information and removes the redundant WPparameter.

FIG. 10 is a diagram that illustrates an example of an encoding orderand a display order (POC: picture order count) in a low-delay encodingstructure according to the first embodiment and illustrates an exampleof an encoding structure in which a B-slice that can be a referenceimage is used as an rB-slice. In the low-delay encoding structure, animage cannot be predicted, and the encoding order and the display orderare the same. Here, a case will be considered in which frames 0 to 3have been encoded in the display order, and a frame 4 is encoded.

FIG. 11 is a diagram that illustrates an example of the relation betweena reference image and a reference number in the low-delay encodingstructure according to the first embodiment and illustrates the relationbetween a reference image and a reference number of a case where theframe 4 is encoded using simplified WP parameter information. In theexample illustrated in FIG. 11, the order of reference numbers within areference list is the same in Lists 0 and 1, which represents that thereference images of Lists 0 and 1 are the same.

FIG. 12 is a diagram that illustrates an example of an encoding orderand a display order in a random access encoding structure according tothe first embodiment. Here, a case will be considered in which frames 0,2, 4, and 8 have been encoded in the display order, and a frame 1 isencoded.

FIG. 13 is a diagram that illustrates an example of the relation betweena reference image and a reference number in the random access encodingstructure according to the first embodiment and illustrates the relationbetween a reference image and a reference number of a case where a frame1 is encoded using simplified WP parameter information. In the exampleillustrated in FIG. 13, while the orders of reference numbers for thereference lists are different from each other, common four referenceimages are included in Lists 0 and 1, which represents the referenceimages of Lists 0 and 1 are the same.

In order to remove redundant WP parameters, in other words, the WPparameters in which reference numbers included in two reference listsrepresent the same reference images, the reference image checking unit401 sorts the reference numbers so as to be converted into a common newindex.

FIG. 14 is a diagram that illustrates an example of the scanning orderof a list number and a reference number of a reference image accordingto the first embodiment. The reference image checking unit 401, in thescanning order illustrated in FIG. 14, a two-dimensional reference list(two reference lists) is converted into a one-dimensional common list(one common list). More specifically, the reference image checking unit401 reads the WP parameter information represented in FIGS. 9A and 9B inthe scanning order illustrated in FIG. 14, sorts the two reference listsinto a common list, and removes redundant WP parameters. Here, thereference image checking unit 401 reads the WP parameter information inaccordance with a pseudo code represented in Numerical Expression (10).

for (scan = 0; scan <= num_of_common_active_ref_minus1; scan++){ list =common_scan_list(scan) ref_idx = common_scan_ref_idx(scan) refPOC =RefPicOrderCount(list, ref_idx) identical_ref_flag = false; for (currIdx= 0; currIdx <= num_of_common_active_ref_minus1; currIdx++){ if(refPOC== CommonRefPicOrderCount(currIdx)){ identical_ref_flag = true; } }if(!identical_ref_flag) InsertCommonRefPicOrderCount(scan, refPOC); }

Here, common_scan_list( ) is a function for returning a list numbercorresponding to a scanning number illustrated in FIG. 14. In addition,common_scan_ref_idx( ) is a function for returning a reference numbercorresponding to a scanning number illustrated in FIG. 14.RefPicOrderCnt( ) is a function for returning a POC number correspondingto a list number and a reference number. Here, the POC number is anumber that represents the display order of reference images. Whenexceeding a maximum number determined in advance, the POC number ismapped into an initial value. For example, in a case where the maximumvalue of the POC number is 255, a POC number corresponding to 256 is 0.CommonRefPicOrderCount( ) is a function for returning a POC numbercorresponding to a reference number of a common list (CommonList).InsertCommonRefPicOrderCount( ) is a function for inserting a POC numbercorresponding to a scanning number into a common list (CommonList).

Here, the scanning order illustrated in FIG. 14 is an example, any otherscanning order may be used as long as it is a scanning order determinedin advance. In addition, the pseudo code represented in NumericalExpression (10) is an example, and addition of a process or removal of aredundant process can be performed as long as the purpose of thisprocess can be realized.

FIGS. 15 and 16 are diagrams that illustrate an example of the WPparameter information after a common list conversion according to thefirst embodiment in a simplified manner. FIG. 15 illustrates the WPparameter information of a common list that is acquired by convertingthe WP parameter information of the reference list illustrated in FIG.11 in a simplified manner, and FIG. 16 illustrates the WP parameterinformation of a common list that is acquired by converting the WPparameter information of the reference list illustrated in FIG. 13 in asimplified manner.

FIG. 17 is a flowchart that illustrates an example of the process ofgenerating index information that is performed by the index setting unit108 according to the first embodiment.

When WP parameter information is input, the reference image checkingunit 401 branches the process in accordance with the type of a slice(Step S101).

In a case where the slice type is a single-directional prediction slice(P-slice) using only one reference list (No in Step S101), the referenceimage checking unit 401 directly outputs the WP parameter informationillustrated in FIG. 9A to the index generating unit 402. The indexgenerating unit 402 generates index information by mapping the WPparameter information input from the reference image checking unit 401into a predetermined syntax element to be described later and outputsthe generated index information.

On the other hand, in a case where the slice type is a bi-directionalprediction slice (B-slice) using two reference lists (Yes in Step S101),the reference image checking unit 401 initializes a variable scan tozero (Step S102). The variable scan represents a scanning numberillustrated in FIG. 14.

Subsequently, the reference image checking unit 401 acquires a variablelist representing a list number corresponding to a scanning number usingthe variable scan (Step S103) and acquires a variable refIdxrepresenting a reference number corresponding to the scanning number(Step S104).

Subsequently, the reference image checking unit 401 derives a variablerefPOC representing a POC number of the reference image corresponding toa list number represented by the variable list and the reference numberrepresented by the variable refIdx (Step S105).

Subsequently, the reference image checking unit 401 sets a flagidentical_ref_flag to false (Step S106) and sets a variable currIdx to“0” (Step S107). The flag identical_ref_flag represents whether or notthere is the same reference image in the common list. The variablecurrIdx represents a reference number of the common list.

Subsequently, the reference image checking unit 401 determines whetheror not the POC number represented by the derived variable refPOC and thePOC number of the reference image corresponding to the reference numberrepresented by the variable currIdx are the same (Step S108).

In a case where both the POC numbers are the same (Yes in Step S108),the reference image checking unit 401 sets the flag identical_ref_flagto true (Step S109). On the other hand, in a case where both the POCnumbers are not the same (No in Step S108), the process of Step S109 isnot performed.

Subsequently, the reference image checking unit 401 increments thevariable currIdx (Step S110).

Subsequently, the reference image checking unit 401 determines whetherthe value of the variable currIdx is larger thannum_of_common_active_ref_minus1 that is a value acquired by subtractingone from a maximum number of the common list (Step S111). Then, when thevalue is num_of_common_active_ref_minus1 or less (No in Step S111), theprocess of Steps S108 to S110 is repeated.

When the value is larger than num_of_common_active_ref_minus1 (Yes inStep S111), the reference image checking unit 401 completes the checkingof the common list and further checks whether or not the flagidentical_ref_flag is false (Step S112).

In a case where the flag identical_ref_flag is false (Yes in Step S112),the reference image checking unit 401 determines that a reference imagethat is the same as the reference image of the POC number represented bythe variable refPOC is not included in the common list and adds the POCnumber represented by the variable refPOC to the common list (StepS113). On the other hand, in a case where the flag identical_ref_flag istrue (No in Step S112), the reference image checking unit 401 determinesthat a reference image that is the same as the reference image of thePOC number represented by the variable refPOC is included in the commonlist and does not perform the process of Step S113.

Subsequently, the reference image checking unit 401 increments thevariable scan (Step S114).

Subsequently, the reference image checking unit 401 determines whetherthe value of the variable scan is num_of_common_active_ref_minus1, whichis a value acquired by subtracting one from a maximum number of thecommon list, or more (Step S115). In a case where the value of thevariable scan is num_of_common_active_ref_minus1 or less (No in StepS115), the process is returned to Step S103. On the other hand, in acase where the value of the variable scan is larger thannum_of_common_active_ref_minus1 (Yes in Step S115), the reference imagechecking unit 401 outputs the WP parameter information after theconversion into the common list to the index generating unit 402. Theindex generating unit 402 generates index information by mapping the WPparameter information input from the reference image checking unit 401into a predetermined syntax element to be described later and outputsthe generated index information.

Referring back to FIG. 1, the encoding unit 110 performs entropyencoding of various encoding parameters such as the quantizationtransformation coefficient input from the quantization unit 103, themotion information input from the motion evaluating unit 109, the indexinformation input from the index setting unit 108, and the quantizationinformation designated by the encoding control unit 111, therebygenerating encoded data. As the entropy encoding, for example, there isa Huffman encoding or arithmetic coding.

Here, the encoding parameters are parameters such as predictioninformation representing a prediction method or the like, informationrelating to the quantization transformation coefficient, and informationrelating to quantization that are necessary for a decoding process. Forexample, it may be configured such that an internal memory notillustrated in the figure is included in the encoding control unit 111,the encoding parameters are maintained in the internal memory, and theencoding parameters of an adjacent pixel block, which has been completedto be encoded, is used when a pixel block is encoded. For example, in anintra-prediction of H.264, prediction information of a pixel block maybe derived from the prediction information of an adjacent block that hasbeen completed to be encoded.

The encoding unit 110 outputs the generated encoded data at appropriateoutput timing managed by the encoding control unit 111. Various kinds ofinformation, which is output encoded data, for example, is multiplexedby a multiplexing unit not illustrated in the figure or the like, istemporarily stored in an output buffer not illustrated in the figure orthe like, and, then, for example, is output to a storage system (storagemedium) or a transmission system (communication line).

FIG. 18 is a diagram that illustrates an example of syntax 500 used bythe encoding device 100 according to the first embodiment. The syntax500 illustrates the structure of encoded data generated by encoding aninput image (moving image data) using the encoding device 100. When theencoded data is decoded, a decoding device to be described laterperforms a syntax analysis of a moving image by referring to a syntaxstructure that is the same as that of the syntax 500.

The syntax 500 includes three parts including a high-level syntax 501, aslice-level syntax 502, and a coding tree level syntax 503. Thehigh-level syntax 501 includes syntax information of an upper layer thathas a level higher than the slice. Here, the slice represents arectangular area or a continuous area included in a frame or a field.The slice-level syntax 502 includes information that is necessary fordecoding each slice. The coding tree level syntax 503 includesinformation that is necessary for decoding each coding tree (in otherwords, each coding tree block). Each of these parts includes moredetailed syntax.

The high-level syntax 501 includes syntax of a sequence and a picturelevel such as a sequence parameter set syntax 504, a picture parameterset syntax 505, and an adaptation parameter set syntax 506.

The slice-level syntax 502 includes a slice header syntax 507, a predweight table syntax 508, a slice data syntax 509, and the like. The predweight table syntax 508 is called from the slice header syntax 507.

The coding tree level syntax 503 includes a coding tree unit syntax 510,a transform unit syntax 511, a prediction unit syntax 512, and the like.The coding tree unit syntax 510 may have a quadtree structure. Morespecifically, the coding tree unit syntax 510 may be recursively furthercalled as a syntax element of the coding tree unit syntax 510. In otherwords, one coding tree block may be subdivided into quadtrees. Inaddition, the transform unit syntax 511 is included in the coding treeunit syntax 510. The transform unit syntax 511 is called from eachcoding tree unit syntax 510 located at a tail end of the quadtree. Inthe transform unit syntax 511, information relating to inverseorthogonal transformation, quantization, and the like is described. Inthe syntax, information relating to the weighted motion compensationprediction may be described.

FIG. 19 is a diagram that illustrates an example of the pictureparameter set syntax 505 according to the first embodiment. Here,weighted_pred_flag, for example, is a syntax element representing thevalidness or invalidness of a weighted compensation prediction accordingto the first embodiment for a P-slice. In a case where theweighted_pred_flag is “0”, the weighted motion compensation predictionaccording to the first embodiment within the P-slice is invalid.Accordingly, the WP application flag included in the WP parameterinformation is constantly set to “0”, and the output ends of the WPselectors 304 and 305 are connected to the default motion compensationunit 301. On the other hand, in a case where the weighted_pred_flag is“1”, the weighted motion compensation prediction according to the firstembodiment within the P-slice is valid.

As another example, in a case where the weighted_pred_flag is “1”, thevalidness or invalidness of the weighted motion compensation predictionaccording to the first embodiment may be defined for each local areawithin the slice in the syntax of a lower layer (the slice header, thecoding tree block, the transform unit, the prediction unit, and thelike).

In addition, weighted_bipred_idc, for example, is a syntax elementrepresenting the validness or invalidness of a weighted compensationprediction according to the first embodiment for a B-slice. In a casewhere the weighted_bipred_idc is “0”, the weighted motion compensationprediction according to the first embodiment within the B-slice isinvalid. Accordingly, the WP application flag included in the WPparameter information is constantly set to “0”, and the output ends ofthe WP selectors 304 and 305 are connected to the default motioncompensation unit 301. On the other hand, in a case where theweighted_bipred_idc is “1”, the weighted motion compensation predictionaccording to the first embodiment within the B-slice is valid.

As another example, in a case where the weighted_bipred_idc is “1”, thevalidness or invalidness of the weighted motion compensation predictionaccording to the first embodiment may be defined for each local areawithin the slice in the syntax of a lower layer (the slice header, thecoding tree block, the transform unit, the prediction unit, and thelike).

FIG. 20 is a diagram that illustrates an example of the slice headersyntax 507 according to the first embodiment. Here, slice-typerepresents the type (an I-slice, a P-slice, a B-slice, or the like) ofslice. In addition, pic_parameter_set_id is an identifier representingwhich picture parameter set syntax 505 to be referred.num_ref_idx_active_override_flag is a flag representing whether toupdate the number of valid reference images, and, in a case where thisflag is “1”, num_ref_idx_10_active_minus1 andnum_ref_idx_11_active_minus1 that define the numbers of reference imagesof the reference list may be used. In addition, pred weight table( ) isa function representing the pred weight table syntax used for a weightedmotion compensation prediction, and this function is called in a casewhere the weighted_pred_flag is “1” in the case of a P-slice and a casewhere weighted_bipred_idc is “1″ in the case of a B-slice.

FIG. 21 is a diagram that illustrates an example of the pred weighttable syntax 508 according to the first embodiment. Here, luma_log2_weight_denom represents the fixed point precision of the weightingfactor of the luminance signal in a slice and is a value correspondingto log WD_(C) represented in Numerical Expression (7) or (9). Inaddition, chroma_log 2_weight_denom represents the fixed point precisionof the weighting factor of a color difference signal in a slice and is avalue corresponding to log WD_(C) represented in Numerical Expression(7) or (9). chroma_format_idc is an identifier representing a colorspace, and MONO_IDX is a value representing a monochrome video. Inaddition, num_ref_common_active_minus1 represents a value that isacquired by subtracting one from the number of reference images includedin a common list in a slice and is used in Numerical Expression (10). Amaximum value of this value is acquired by adding maximum values of thenumbers of reference images of two Lists 0 and 1.

luma_weight_common_flag represents a WP application flag of a luminancesignal. In a case where this flag is “1”, a weighted motion compensationprediction of the luminance signal according to the first embodiment isvalid for the whole area within the slice. In addition,chroma_weight_common_flag represents a WP application flag of a colordifference signal. In a case where this flag is “1”, a weighted motioncompensation prediction of a color difference signal according to thefirst embodiment is valid for the whole area within the slice. Here,luma_weight_common[i] is a weighting factor of the i-th luminance signalmanaged in the common list. In addition, luma_offset_common[i] is anoffset of the i-th luminance signal managed in the common list. Theseare values corresponding to w_(0C), w_(1C), o_(0C), and o_(1C)represented in Numerical Expression (7) or (9). Here, C=Y.

Here, chroma_weight_common[i][j] is a weighting factor of the i-th colordifference signal managed in the common list. In addition,chroma_offset_common[i][j] is an offset of the i-th color differencesignal managed in the common list. These are values corresponding tow_(0C), w_(1C), o_(0C), represented in Numerical Expression (7) or (9).Here, C=Cr or Cb. In addition, j represents a component of the colordifference, and, for example, in the case of a signal of YUV 4:2:0, j=0represents a Cr component, and j=1 represents a Cb component.

As above, in the first embodiment, in a case where there arecombinations including the same reference image in two reference listsof Lists 0 and 1 in the WP parameter information, the index setting unit108 converts the two reference lists into a common list, therebyremoving a redundant WP parameter that is duplicate based on the WPparameter information and generating index information. Therefore,according to the first embodiment, the code amount of the indexinformation can be reduced.

Particularly, since the weighting factor and the offset need to beencoded for each reference image, the amount of information to besignaled to the decoder increases in accordance with an increase in thenumber of reference images. However, as the number of reference imagesincreases, the number of cases where the same reference image isreferred to in the reference list increases, and accordingly, bymanaging a common list, an advantage of markedly reducing the codeamount can be expected.

Modification of First Embodiment

A modification of the first embodiment will be described. In themodification of the first embodiment, syntax elements used by the indexgenerating unit 402 are different from those of the first embodiment.

FIG. 22 is a diagram that illustrates an example of a sequence parameterset syntax 504 according to a modification of the first embodiment.Here, profile_idc is an identifier representing information relating toa profile of encoded data. level_idc is an identifier representinginformation relating to a level of encoded data. In addition,seq_parameter_set_id is an identifier representing a sequence parameterset syntax 504 that is referred to. num_ref_frames is a variablerepresenting a maximal number of reference images in a frame. Inaddition, weighted_prediction_enabled_flag, for example, is a syntaxelement representing the validness/invalidness of a weighted motioncompensation prediction according to the modification for encoded data.

In a case where weighted_prediction_enabled_flag is “0”, a weightedmotion compensation prediction according to the modification in theencoded data is invalid. Accordingly, the WP application flag includedin the WP parameter information is constantly set to “0”, and the WPselectors 304 and 305 connect the output ends thereof to the defaultmotion compensation unit 301. On the other hand, in a case whereweighted_prediction_enabled_flag is “1”, a weighted motion compensationprediction according to the modification is valid in the whole area ofthe encoded data.

As another example, in a case where weighted_prediction_enabled_flag is“1”, the validness/invalidness of a weighted motion compensationprediction according to the modification may be defined for each localarea inside the slice in syntax of a further lower layer (a pictureparameter set, an adaptation parameter set, a slice header, a codingtree block, a transform unit, a prediction unit, and the like).

FIG. 23 is a diagram that illustrates an example of the adaptationparameter set syntax 506 according to a modification of the firstembodiment. The adaptation parameter set syntax 506 maintains aparameter influencing the whole encoding frame and is independentlyencoded as a higher-level unit. For example, in H.264, a syntax elementcorresponding to a high-level syntax 501 is encoded as a NAL unit.Accordingly, the encoding unit of the adaptation parameter set syntax506 is different from that of syntax of a level lower than the level ofthe slice-level syntax 502 that maintains a parameter of lower-levelinformation represented by a slice or a pixel block

Here, aps_id is an identifier representing an adaptation parameter setsyntax 506 that is referred to. By referring to this identifier, alower-level slice can refer to an arbitrary aps_id that has beenencoded. In such a case, for example, by adding the same aps_id to theslice header syntax 507 represented in FIG. 20, a parameter influencingthe whole frame can be read.

aps_weighted_prediction_flag, for example, is a syntax elementrepresenting the validness or invalidness of a weighted motioncompensation prediction according to the modification for a P-slice in aframe. In a case where aps_weighted_prediction_flag is “0”, a weightedmotion compensation prediction according to the modification for aP-slice within the frame is invalid. Accordingly, the WP applicationflag included in the WP parameter information is constantly set to “0”,and the WP selectors 304 and 305 connect the output ends thereof to thedefault motion compensation unit 301. On the other hand, in a case whereaps_weighted_prediction_flag is “1”, a weighted motion compensationprediction according to the modification is valid for the whole areawithin the frame.

In addition, as another example, in a case whereaps_weighted_prediction_flag is “1”, in syntax of a lower layer (a sliceheader, a coding tree block, a transform unit, a prediction unit, andthe like), the validness or invalidness of a weight motion compensationprediction according to the modification may be defined for each localarea inside the slice.

aps_weighted_bipred_idx, for example, is a syntax element representingthe validness or invalidness of a weighted motion compensationprediction according to the modification for a B-slice in a frame. In acase where aps_weighted_bipred_idx is “0”, a weighted motioncompensation prediction according to the modification for a P-slicewithin the frame is invalid. Accordingly, the WP application flagincluded in the WP parameter information is constantly set to “0”, andthe WP selectors 304 and 305 connect the output ends thereof to thedefault motion compensation unit 301. On the other hand, in a case whereaps_weighted_bipred_idx is “1”, a weighted motion compensationprediction according to the modification is valid for the whole areawithin the frame.

In addition, as another example, in a case where aps_weighted_bipred_idxis “1”, in syntax of a lower layer (a slice header, a coding tree block,a transform unit, a prediction unit, and the like), the validness orinvalidness of a weight motion compensation prediction according to themodification may be defined for each local area inside the slice.

Furthermore, pred weight table( ) is a function representing a predweight table syntax used for a weighted motion compensation prediction,and this function is called in a case where aps_weighted_prediction_flagdescribed above is “1” or aps_weighted_bipred_idx is “1”.

FIG. 24 is a diagram that illustrates an example of the pred weighttable syntax 508 according to a modification of the first embodiment. Inthe modification of the first embodiment, in the syntax structureillustrated in FIG. 18, the pred weight table syntax 508 is called fromthe adaptation parameter set syntax 506. A difference from the predweight table syntax 508 illustrated in FIG. 21 is that,num_ref_common_active_minus1 is replaced by MAX_COMMON_REF_MINUS1. Sincethe number of reference images is described in the slice header syntax507, it cannot be referred to in the adaptation parameter set syntax 506that is a higher-level layer. Accordingly, for example, a value acquiredby subtracting one from the value of num_ref_frames described in thesequence parameter set syntax 504 is set to MAX_COMMON_REF_MINUS1. Inaddition, a value taken as a maximum number of reference images may beset in accordance with a predetermined profile or level. The othersyntax elements are the same as those illustrated in FIG. 21.

As above, according to the modification of the first embodiment, byemploying a structure in which the pred weight table syntax 508 iscalled from the adaptation parameter set syntax 506, the code amount ofthe WP parameter information at the time of dividing one frame into aplurality of slices can be markedly reduced.

For example, by encoding the adaptation parameter set syntax 506 havingmutually-different three types of used WP parameter information firstand calling necessary WP parameter information from the slice headersyntax 507 using aps_id depending on the situations, the code amount canbe smaller than that of a configuration in which the WP parameterinformation is constantly encoded by the slice header syntax 507.

Second Embodiment

A second embodiment will be described. In an encoding device 600according to the second embodiment, the configuration of an indexsetting unit 608 is different from that of the encoding device 100according to the first embodiment. Hereinafter, differences from thefirst embodiment will be mainly described, the same name/referencenumeral as those of the first embodiment will be assigned to eachconstituent element having the same function as that of the firstembodiment, and the description thereof will not be presented.

FIG. 25 is a block diagram that illustrates an example of theconfiguration of the index setting unit 608 according to the secondembodiment. The index setting unit 608, as illustrated in FIG. 25,includes a reuse determining unit 601 and an index generating unit 602.

The reuse determining unit 601 combines a reference number of List 1with a reference number of List 0 and determines whether to reuse the WPparameter information of List 0 as the WP parameter information ofList 1. In a case where the same reference image is included in the tworeference lists, and the values of corresponding WP parameterinformation are the same, when the same information is encoded not onlyin List 0 but also in List 1, the code amount increases. Accordingly,the reuse determining unit 601 reuses the WP parameter information ofList 0.

More specifically, in a case where the WP parameter information of List0 is reused, the reuse determining unit 601 sets the reuse flag to “1”and set the reference number of a reference destination (List 0) asreference information. On the other hand, in a case where the WPparameter information of List 0 is not reused, the reuse determiningunit 601 sets the reuse flag to “0” and sets WP parameter informationcorresponding to the reference number of List 1 in the syntax.

The reuse determining unit 601, for example, in accordance with a pseudocode represented in Numerical Expression (11), determines whether or notto reuse the WP parameter information of List 0 as the WP parameterinformation of List 1.

for (refIdx = 0; refIdx <= num_of_active_ref_l1_minus1; refIdx++){refPOC = RefPicOrderCnt(ListL1, refIdx) refWP = RefWPTable(ListL1,refIdx) reuse_wp_flag = false; reuse_ref_idx = 0; for (currIdx = 0;currIdx <= num_of_active_ref_l0_minus1; currIdx++){ if( refPOC ==RefPicOrderCnt(ListL0, currIdx) && RefWPTable(ListL0, currIdx, refWP) ){reuse_wp_flag = true; reuse_ref_idx = currIdx; } } }

Here, ListL0 represents List 0, and ListL1 represents List 1.RefWPTable( ) is a function for returning whether or not an inputreference WP parameter matches a WP parameter corresponding to a listnumber and a reference number, which have been input, as a flag when thelist number, the reference number, and the reference WP parameter areinput. In a case where the value of the flag is “1”, it represents thatboth the WP parameters match each other. In the pseudo code representedin Numerical Expression (11), in a case where the reference numbers ofList 1 are sequentially scanned, and there are reference images havingthe same POC number within List 0, when the WP parameters are the same,reuse_wp_flag representing a reuse flag is set to ture, and a referencenumber corresponding to List 0 is set to reuse_ref_idx.

The reuse determining unit 601 outputs the WP parameter informationafter the reuse determination so as to be input to the index generatingunit 602.

The index generating unit 602 receives the WP parameter informationafter the reuse determination from the reuse determining unit 601 andmaps the WP parameter information after the reuse into a syntax elementto be described later, thereby generating index information. The syntaxelement into which the WP parameter information is mapped by the indexgenerating unit 602 is different from that of the first embodiment. Theindex generating unit 602 outputs the index information so as to beinput to the encoding unit 110.

FIG. 26 is a flowchart that illustrates an example of the process ofgenerating index information that is performed by the index setting unit608 according to the second embodiment.

When the WP parameter information is input, the reuse determining unit601 branches the process based on the slice type (Step S201).

In a case where the slice type is a single-directional prediction slice(P-slice) using only one reference list (No in Step S201), the reusedetermining unit 601 directly outputs the WP parameter informationillustrated in FIG. 9A to the index generating unit 602. The indexgenerating unit 602 generates index information by mapping the WPparameter information input from the reuse determining unit 601 into apredetermined syntax element to be described later and outputs thegenerated index information.

On the other hand, in a case where the slice type is a bi-directionalprediction slice (B-slice) using two reference lists (Yes in Step S201),the reuse determining unit 601 initializes a variable refIdc to zero(Step S202). The variable refIdc represents a reference number of List1.

Subsequently, the reuse determining unit 601 derives a variable refPOCrepresenting a POC number of a reference image corresponding to thereference number represented by the variable refIdx (Step S203) andderives a WP parameter corresponding to a reference number representedby the variable refIdx (Step S204).

Subsequently, the reuse determining unit 601 sets a flag reuse_wp_flagto false (Step S205) and sets a variable currIdx to “0” (Step S206). Theflag reuse_wp_flag represents whether the WP parameters of Lists 0 and 1are the same. In addition, the variable currIdx represents a referencenumber of List 0.

Subsequently, the reuse determining unit 601 determines whether a POCnumber represented by the derived variable refPOC and a POC number of areference image corresponding to the reference number represented by thevariable currIdx are the same, and a WP parameter corresponding to thereference number represented by the variable refIdx and a WP parametercorresponding to the reference number represented by the variablecurrIdx are the same (Step S207).

In a case where both the POC numbers and both the WP parameters are thesame (Yes in Step S207), the reuse determining unit 601 sets a flagreuse_wp_flag to true (Step S208) and substitutes the value of thevariable currIdx into the variable reuse_ref_idx (Step S209). On theother hand, in a case where both POC numbers or both the WP parametersare not the same (No in Step S207), the process of Steps S208 and S209is not performed. In addition, a configuration may be employed in whichthe matching of the POC numbers is not checked.

Subsequently, the reuse determining unit 601 increments the variablecurrIdx (Step S210).

Subsequently, the reuse determining unit 601 determines whether thevalue of the variable currIdx is num_of_active_ref_10_minus1, which is avalue acquired by subtracting one from a maximum number of List 0, ormore (Step S211). In a case where the value of the variable currIdx isnum_of_active_ref_10_minus1 or less (No in Step S211), the process ofSteps S207 to S210 is repeated.

On the other hand, in a case where the value of the variable currIdx islarger than num_of_active_ref_10_minus1 (Yes in Step S211), the reusedetermining unit 601 completes the checking of List 0 and increments thevariable refIdx (Step S212).

Subsequently, the reuse determining unit 601 determines whether thevalue of the variable refIdx is num_of_active_ref_11_minus1, which is avalue acquired by subtracting one from a maximum number of List 1, ormore (Step S213). In a case where the value of the variable refIdx isnum_of_active_ref_11_minus1 or less (No in Step S213), the process ofSteps S203 to S212 is repeated.

On the other hand, in a case where the value of the variable refIdx islarger than num_of_active_ref_11_minus1 (Yes in Step S213), the reusedetermining unit 601 completes the checking of List 1 and outputs the WPparameter information after the reuse determination to the indexgenerating unit 602. The index generating unit 602 generates indexinformation by mapping the WP parameter information input from the reusedetermining unit 601 into a predetermined syntax element to be describedlater and outputs the generated index information.

FIG. 27 is a diagram that illustrates an example of the pred weighttable syntax 506 according to the second embodiment. In syntax elementsillustrated in FIG. 27, symbols of 10 and 11 correspond to Lists 0 and1, respectively. In addition, a syntax element having the same prefix asthat illustrated in FIG. 21 is used as the same variable except fordifferent treatment of a reference list although there is a differenceof List 0 or List 1 but not of common list. For example,luma_weight_10[i] is a syntax element representing a weighting factor ofthe i-th reference number in the reference list 10.

luma_log 2_weight_denom and chroma_log 2_weight_denom have the sameconfiguration as that of the first embodiment. First, for List 0 inwhich a symbol of 10 is included, luma_weight_10_flag,luma_weight_10[i], luma_offset_10[i], chroma_weight_10_flag,chroma_weight_10[1][j], and chroma_offset_10[i][j] are defined. Next,syntax elements for List 1 in which a symbol of 11 is included aredefined.

Here, reuse_wp_flag is a syntax element representing whether or not a WPparameter of 10 corresponding to List 0 is reused. In a case wherereuse_wp_flag is “1”, the weighing factor and the offset are notencoded, but reuse_ref_idx is encoded. reuse_ref_idx represents areference number of 10 corresponding to List 0 to which the WP parametercorresponds that is used. For example, in a case where reuse_ref_idx is“1”, a WP parameter corresponding to a reference number “1” of List 0 iscopied to a WP parameter corresponding to the reference number i ofList 1. On the other hand, in a case where reuse_wp_flag is “0”,similarly to List 0, luma_weight_11_flag, luma_weight_11[i],luma_offset_11[i], chroma_weight_11_flag, chroma_weight_11[i][j], andchroma_offset_11[i][j] are encoded.

As above, according to the second embodiment, in a case where there is acombination including the same reference image in two reference lists ofLists 0 and 1 in the WP parameter information, the index setting unit608 removes a redundant WP parameter that is duplicate in the WPparameter information and generates index information by reusing theduplicate WP parameter. Therefore, according to the second embodiment,the code amount of the index information can be reduced.

According to the second embodiment, WP parameter informationcorresponding to List 0 is encoded in a conventional manner, and, inorder to encode the WP parameter information corresponding to List 1, itis checked whether the same reference image is to be referred to insideList 0. In addition, the same reference image is referred to, and, in acase where the WP parameters are the same as well, informationrepresenting a reference number of List 0 to which the WP parametercorresponds is encoded together with encoding the flag for reusing theWP parameter of List 0. The amount of such information is markedlysmaller than that of information relating to the weighting factor andthe offset, and accordingly, the code amount of the WP parameterinformation can be configured to be much smaller than that of a casewhere Lists 0 and 1 are separately encoded.

In addition, according to the second embodiment, in a case where thereference numbers included in Lists 0 and 1 represent the same referenceimage, and the WP parameters are different from each other, WPparameters different from each other can be set. In other words, in acase where there is a combination representing the same reference imagewithin reference lists, the same WP parameters are forcibly set in thefirst embodiment, and, a redundant representation of the same WPparameters is removed only in a case where the WP parameters are thesame in the second embodiment.

Third Embodiment

A third embodiment will be described. FIG. 28 is a block diagram thatillustrates an example of the configuration of an encoding device 700according to the third embodiment. The encoding device 700 according tothe third embodiment further includes a motion information memory 701, amotion information acquiring unit 702, and a selector switch 703, whichis different from the encoding device 100 according to the firstembodiment. Hereinafter, differences from the first embodiment will bemainly described, the same name/reference numeral will be assigned toeach constituent element having the same function as that of the firstembodiment, and the description thereof will not be presented.

The motion information memory 701 temporarily stores motion informationapplied to a pixel block that has been encoded as reference motioninformation. The motion information memory 701 may reduce the amount ofinformation by performing a compression process such as sub-sampling forthe motion information.

FIG. 29 is a diagram that illustrates a detailed example of the motioninformation memory 701 according to the third embodiment. The motioninformation memory 701, as illustrated in FIG. 29, is maintained inunits of frames or slices and further includes a spatial-directionalreference motion information memory 701A that stores motion informationon a same frame as reference motion information 710 and atime-directional reference motion information memory 701B storing motioninformation of a frame that has been encoded as reference motioninformation 710. A plurality of time-directional reference motioninformation memories 701B may be arranged in accordance with the numberof reference frames used by the encoding target frame for a prediction.

The reference motion information 710 is maintained in thespatial-directional reference motion information memory 701A and thetime-directional reference motion information memory 701B in units ofpredetermined areas (for example, in units of 4×4 pixel blocks). Thereference motion information 710 further includes informationrepresenting whether the area is encoded by an inter-prediction to bedescribed later or is encoded by an intra-prediction to be describedlater. In addition, also in a case where a pixel block (a coding unit ora prediction unit) is inter-predicted using motion information predictedfrom an encoded area without the value of a motion vector included inthe motion information being encoded as in a skip mode or a direct modedefined in H.264 or a merge mode to be described later, the motioninformation of the pixel block is maintained as the reference motioninformation 710.

When the encoding process for the encoding target frame or the encodingtarget slice is completed, the spatial-directional reference motioninformation memory 701A of the frame is changed to be treated as thetime-directional reference motion information memory 701B used for aframe to be encoded next. At this time, in order to reduce the capacityof the time-directional reference motion information memory 701B, it maybe configured such that the motion information is compressed, and thecompressed motion information is stored in the time-directionalreference motion information memory 701B.

The motion information acquiring unit 702 receives reference motioninformation from the motion information memory 701 as input and outputsmotion information B used for an encoding pixel block. Details of themotion information acquiring unit 702 will be described later.

The selector switch 703 selects one of the motion information B outputfrom the motion information acquiring unit 702 and motion information Aoutput from the motion evaluating unit 109 in accordance with predictionmode information to be described later and outputs the selected motioninformation to the predicted image generating unit 107 as motioninformation. The motion information A output from the motion evaluatingunit 109 is used for encoding information of a difference from apredicted motion vector acquired from a predicted motion vectoracquiring unit not illustrated in the figure and predicted motion vectoracquiring position information. Hereinafter, such a prediction mode willbe referred to as an inter-mode. On the other hand, the motioninformation B output from the motion information acquiring unit 702 inaccordance with prediction mode information is used for merging motioninformation from adjacent pixel blocks and is directly applied to anencoding pixel block, and accordingly, other information (for example,motion vector difference information) relating to the motion informationdoes not need to be encoded. Hereinafter, such a prediction mode will bereferred to as a merge mode.

The prediction mode information is in accordance with a prediction modethat is controlled by the encoding control unit 111 and includesswitching information of the selector switch 703.

Hereinafter, details of the motion information acquiring unit 702 willbe described.

The motion information acquiring unit 702 receives the reference motioninformation as an input and outputs the motion information B to theselector switch 703. FIGS. 30A and 30B are diagrams that illustrate anexample of block positions at which motion information candidates arederived for an encoding pixel block according to the third embodiment.In FIG. 30A, A to E represent pixel blocks, which are spatially adjacentto the encoding pixel block, used for deriving motion informationcandidates. In addition, in FIG. 30B, T represents a pixel block, whichis adjacent in time, used for deriving a motion information candidate.

FIG. 31 is a diagram that illustrates an example of the relation betweenpixel block positions of a plurality of motion information candidatesand pixel block position indices (idx) according to the thirdembodiment. The block positions of the motion information candidates arearranged in order of spatially-adjacent block positions A to E and thepixel block position T that is adjacent in time, and, in a case wherethere is an available (an inter-prediction is applied) pixel block inthe order, indices idx are sequentially assigned thereto until themaximum number (N−1) of the motion information stored in the storagelist MergeCandList of the merge mode is reached.

FIG. 32 is a flowchart that illustrates an example of a storage processfor MergeCandList according to the third embodiment.

First, the motion information acquiring unit 702 initializes the storagenumber numMergeCand for MergeCandList to “0” (Step S301).

Subsequently, the motion information acquiring unit 702 determineswhether or not all the spatially-adjacent blocks (for example, blocks Ato E) are available (Steps S302 and S303). In a case where all thespatially-adjacent blocks are available (Yes in Step S303), the motioninformation acquiring unit 702 stores the motion information of thespatially-adjacent blocks in MergeCandList and increment numMergeCand(Step S304). On the other hand, in a case where all thespatially-adjacent blocks are not available (No in Step S303), themotion information acquiring unit 702 does not perform the process ofStep S304.

When the process of Steps S303 and S304 is performed for all thespatially-adjacent blocks (Step S305), the motion information acquiringunit 702 determines whether a block (for example, the block T) that isadjacent in time is available (Step S306).

In a case where the block that is adjacent in time is available (Yes inStep S306), the motion information acquiring unit 702 stores the motioninformation of the block T that is adjacent in time in MergeCandList andincrement numMergeCand (Step S307). On the other hand, in a case wherethe block that is adjacent in time is not available (No in Step S306),the motion information acquiring unit 702 does not perform the processof Step S307.

Subsequently, the motion information acquiring unit 702 removesduplicate motion information within MergeCandList and decreasesnumMergeCand by a value corresponding to the number of removals (StepS308). In order to determine whether or not the motion information isduplicate within MergeCandList, the motion information acquiring unit702 determines whether or not two types of motion information (a motionvector my and a reference number refIdx) and WP parameter informationwithin MergeCandList match each other and removes one side fromMergeCandList[ ] in a case where all the information match each other

FIG. 33 is a diagram that illustrates an example of a storage list ofmotion information according to the third embodiment and, described indetail, illustrates an example of a storage list MergeCandList[idx] ofmotion information (a motion vector my and a reference number refIdx)corresponding to each idx in accordance with the table illustrated inFIG. 31 with N=5. In FIG. 33, in a storage list of idx=0, referencemotion information (a motion vector mv0L0, a reference number refIdx0L0)of List 0 is stored, in a storage list of idx=1, reference motioninformation (a motion vector mv1L1, a reference number refIdx1L1) ofList 1 is stored, and, in storage lists of idx=2 to 4, reference motioninformation (motion vectors mv2L0 and mv2L1, reference numbers refIdx2L0and refIdx2L1) of both Lists 0 and 1 are stored.

The encoding pixel block selects one of a maximum N kinds of indicesidx, derives reference motion information of a pixel block correspondingto the selected index idx from MergeCandList[idx], and outputs thederived reference information as motion information B. In a case wherethere is no reference motion information, the encoding pixel blockoutputs motion information having a zero vector as a predicted motioninformation candidate B. The information (a syntax merge idx to bedescribed later) of the selected index idx is included in the predictedmode information and is encoded by the encoding unit 110.

In addition, blocks that are adjacent in space or time are not limitedto those illustrated in FIGS. 30A and 30B, and the adjacent block may belocated at any position within an area that has been encoded.Furthermore, as another example of the above-described list, the maximumstorage number (N) for MergeCandList and the storage order forMergeCandList are not limited to the above-described ranges, andarbitrary order or an arbitrary maximum number may be used.

In a case where the encoded slice is a B slice, and the maximum storagenumber N has not been arrived even in a case where the reference motioninformation of the pixel blocks that are adjacent in time or space isstored in MergeCandList[ ], the motion information of List 0 and themotion information of List 1 stored in MergeCandList[ ] at that timepoint are combined so as to newly generate a bi-directional prediction,and the generated bi-directional prediction is stored in MergeCandList[].

FIG. 34 is a flowchart that illustrates an example of a method ofstoring motion information in the storage list according to the thirdembodiment.

First, the motion information acquiring unit 702 sets the storage numberfrom pixel blocks adjacent in time or space to MergeCandList tonumInputMergeCand, initializes a variable numMergeCand representing thecurrent storage number to numInputMergeCand, and initializes variablescombIdx and combCnt to zero (Step S401).

Subsequently, the motion information acquiring unit 702 derivesvariables 10CandIdx and 11CandIdx from combIdx using a newly generatedcombination (see FIG. 35) of bi-directional predictions (Step S402). Inaddition, the combinations for deriving the variables 10CandIdx and11CandIdx from the variable combIdx are not limited to the exampleillustrated in FIG. 36 but may be arranged in arbitrary order unlessthey are duplicate.

Subsequently, the motion information acquiring unit 702 sets thereference motion information (two types of Lists 0 and 1 in the case ofa bi-directional prediction) stored in MergeCandList[10CandIdx] to10Cand. A reference number at motion information of 10Cand will bereferred to as refIdxL010Cand, and a motion vector at the motioninformation of 10Cand will be referred to as mvL010Cand. Similarly, themotion information acquiring unit 702 sets the reference motioninformation stored in MergeCandList[11CandIdx] to 11Cand. A referencenumber at reference motion information of 11Cand will be referred to asrefIdxL111Cand, and a motion vector at the reference motion informationof 11Cand will be referred to as mvL111Cand (Step S403). In addition, acombination of motion information for making a bi-directional predictionusing 10Cand as the motion information of List 0 and L1Cand as themotion information of List 1 will be referred to as combCand.

Subsequently, the motion information acquiring unit 702 determineswhether or not blocks referred to by 10Cand and 11Cand are the sameusing Conditional Equations (12) to (15) (Step S404).

Are10Cand and 11Cand available?  (12)

RefPicOrderCnt(refIdxL010Cand,L0)!=RefPicOrderCnt(refIdxL111Cand,L1)  (13)

mvL010Cand !=mvL111Cand  (14)

WpParam(refIdxL010Cand,L0)!=WpParam(refIdxL111Cand,L1)  (15)

RefPicOrderCnt(refIdx, LX) is a function for deriving a POC (PictureOrder Count) of a reference frame corresponding to the reference numberrefIdx in reference list X (here, X=0 or 1). In addition,WpParam(refIdx, LX) is a function for deriving WP parameter informationof a reference frame corresponding to the reference number refIdx inreference list X (here, X=0 or 1). This function returns “Yes” in a casewhere reference frames of List 0 and 1 do not have the same WPparameters (presence/no presence of WP WP_flag, a weighting factorWeight, and an offset Offset) and returns “No” in a case where thereference frames have totally same parameters. As another example ofWpParam( ) the determination may be made using only a part of the dataof WP parameters as in a case where only the matching of thepresence/no-presence of WP WP-flag and the offsets Offset are checkedwithout checking the matching of all the parameters or the like.

In a case where Conditional Equation (12) is satisfied, and one ofConditional Equations (13) to (15) is satisfied (Yes in Step S404), themotion information acquiring unit 702 determines whether or not there isa bi-directional prediction using the same combination as that of 10Candand 11Cand within mergeCandList[ ] (Step S405).

In a case where there is the same combination as that of 10Cand and11Cand within mergeCandList[ ] (Yes in Step S405), the motioninformation acquiring unit 702 adds combCand to the rearmost end ofmergeCandList (Step S406). More specifically, the motion informationacquiring unit 702 substitutes combCand into mergeCandList[numMergeCand]and increments numMergeCand and combCnt.

Subsequently, the motion information acquiring unit 702 incrementscombIdx (Step S407).

Subsequently, the motion information acquiring unit 702 determineswhether to complete storage for mergeCandList[ ] by using ConditionalEquations (16) to (18) (Step S408).

combIdx==numInputMergeCand*(numInputMergeCand?1))  (16)

numMergeCand==maxNumMergeCand  (17)

combCnt==N  (18)

In a case where one of Conditional Equations (16) to (18) is satisfied(Yes in Step S408), the process ends. On the other hand, in a case whereall the Conditional Equations (16) to (18) are satisfied (No in StepS408), the process is returned to Step S402.

The process of a case where the encoding slice is a B slice, and themaximum storage number N has not been reached even when the referencemotion information of pixel block that are adjacent in space or time isstored in MergeCandList[ ] has been described. As above, the motioninformation B is output from the motion information acquiring unit 702to the selector switch 703.

FIG. 36 is a diagram that illustrates an example of a pred unit syntax512 according to the third embodiment. skip_flag is a flag representingwhether or not a prediction mode of a coding unit to which a predictionunit syntax belongs is a skip mode. In a case where skip_flag is “1”, itrepresents that syntaxes (the coding unit syntax, the prediction unitsyntax, and the transform unit syntax) other than the prediction modeinformation are not encoded. On the other hand, in a case whereskip_flag is “0”, it represents that the prediction mode of a codingunit to which the prediction unit syntax belongs is not a skip mode.

Next, merge_flag that is a flag representing whether or not the encodingpixel block (prediction unit) is in the merge mode is encoded. In a casewhere the value of Merge_flag is “1”, it represents that the predictionunit is in the merge mode. On the other hand, in a case where the valueis “0″, it represents that the prediction unit uses an inter-mode. Inthe case of Merge_flag, merge idx that is information used forspecifying the pixel block position index (idx) described above isencoded.

In a case where Merge_flag is “1”, prediction unit syntaxes other thanmerge_flag and merge idx do not need to be encoded. On the other hand,in a case where Merge_flag is “0”, it represents that the predictionunit is the inter-mode.

As above, according to the third embodiment, in simultaneously applyingthe weighted motion compensation and the merge mode, the encoding device700 solves the problem in which reference motion information of pixelblocks adjacent in space or time is removed from MergeCandList even in acase where motion vectors and reference numbers match each other and WPparameter information is different from each other when the motioninformation that is duplicate within the storage list MergeCandList ofthe merge mode is removed. In addition, in a case where the maximumstorage number N has not been reached even when the reference motioninformation is stored in MergeCandList, a problem is solved in which twotypes of motion information used for a bi-directional prediction referto the same block when motion information of Lists 0 and 1 stored inMergeCandList at that time point is combined together, and abi-directional prediction is newly generated and is stored inMergeCandList[ ].

In a case where two types of motion information used for abi-directional prediction refer to the same block, a predicted valueaccording to a bi-directional prediction and a predicted value accordingto a single-directional prediction match each other. Generally, theefficiency of the bi-directional prediction is higher than theefficiency of the single-directional prediction, and accordingly, it ispreferable that the two types of motion information used for abi-directional prediction do not refer to the same block. When it isdetermined whether or not the two types of motion information used for abi-directional prediction refer to the same block, in addition to thereference frame number position (POC) derived from a reference number, aparameter of the weighted motion compensation is introduced to thedetermination item. Accordingly, even when the reference frame numberposition (POC) is the same as of the motion vector, the encoding device700 determines that two types of motion information havingmutually-different parameters of the weighted motion compensation do notrefer to the same block, and the prediction efficiency of the motioninformation used for the bidirectional prediction stored in the storagelist of the merge mode can be improved.

In addition, as another example of the storage process forMergeCandList, it may be configured such that it is determined whetheror not the WP parameter of the reference frame of a block T that isadjacent in time and the WP parameter of the reference frame of theencoding pixel block match each other when the motion information of theblock T that is adjacent in time is stored in MergeCandList, and themotion information is stored in MergeCandList only in a case where theWP parameters match each other. The reason for this that, in a casewhere the WP parameter of the reference frame of the block T that isadjacent in time and the WP parameter of the reference frame of theencoding pixel block are different from each other, it can be estimatedthat the correlation between the motion information of the block T thatis adjacent in time and the motion information of the encoding pixelblock is lowered.

FIG. 37 is a flowchart that illustrates another example of the storageprocess for MergeCandList according to the third embodiment. Theflowchart illustrated in FIG. 38 is the same as that illustrated in FIG.32 except for Step S507.

In addition, as a further another example, in a case where WP parameterof the reference frame of the block T that is adjacent in time and theWP parameter of the reference frame of the encoding pixel block aredifferent from each other, a block having the same WP parameter in thereference frame of the encoding pixel block out of blocks adjacent tothe block T in space may be replaced with the block T. At this time, thecorrelation between the motion information of the block T that isadjacent in time and the motion information of the encoding pixel blockis not lowered.

Fourth Embodiment

In a fourth embodiment, a decoding device that decodes encoded dataencoded by the encoding device according to the first embodiment will bedescribed.

FIG. 38 is a block diagram that illustrates an example of theconfiguration of the decoding device 800 according to the fourthembodiment.

The decoding device 800 decodes encoded data stored in an input buffernot illustrated in the figure or the like into a decoded image andoutputs the decoded image to an output buffer not illustrated in thefigure as an output image. The encoded data, for example, is output fromthe encoding device 100 illustrated in FIG. 1 or the like and is inputto the decoding device 800 through a storage system, a transmissionsystem, a buffer, or the like not illustrated in the figure.

The decoding device 800, as illustrated in FIG. 38, includes: a decodingunit 801, an inverse quantization unit 802; an inverse orthogonaltransformation unit 803; an addition unit 804; a predicted imagegenerating unit 805; and an index setting unit 806. The inversequantization unit 802, the inverse orthogonal transformation unit 803,the addition unit 804, and the predicted image generating unit 805 areelements that are substantially the same as or similar to the inversequantization unit 104, the inverse orthogonal transformation unit 105,the addition unit 106, and the predicted image generating unit 107illustrated in FIG. 1, respectively. In addition, a decoding controlunit 807 illustrated in FIG. 38 controls the decoding device 800 and,for example, is realized by a CPU or the like.

In order to decode encoded data, the decoding unit 801 performs decodingbased on the syntax for each frame or each field. The decoding unit 801sequentially performs entropy decoding of a code string of each syntaxand regenerates motion information including a prediction mode, a motionvector, and a reference number, index information used for a weightedmotion compensated prediction, and encoding parameters of an encodingtarget block such as a quantization transformation coefficient and thelike. Here, the encoding parameters are all the parameters that arenecessary for decoding information relating to a transformationcoefficient, information relating to quantization, and the like inaddition to those described above. The decoding unit 801 outputs themotion information, the index information, and the quantizationtransformation coefficient, so as to input the quantizationtransformation coefficient to the inverse quantization unit 802, inputthe index information to the index setting unit 806, and input themotion information to the predicted image generating unit 805.

The inverse quantization unit 802 performs an inverse quantizationprocess for the quantization transformation coefficient input from thedecoding unit 801 and acquires a restoration transformation coefficient.More specifically, the inverse quantization unit 802 performs inversequantization based on the quantization information used by the decodingunit 801. Described in more detail, the inverse quantization unit 802multiplies the quantization transformation coefficient by a quantizationstep size derived based on the quantization information, therebyacquiring a restored transformation coefficient. The inversequantization unit 802 outputs the restored transformation coefficient soas to be input to the inverse orthogonal transformation unit 803.

The inverse orthogonal transformation unit 803 performs an inverseorthogonal transformation corresponding to the orthogonal transformationperformed on the encoding side for the restored transformationcoefficient input from the inverse quantization unit 802, therebyacquiring a restored prediction error. The inverse orthogonaltransformation unit 803 outputs the restored prediction error so as tobe input to the addition unit 804.

The addition unit 804 adds the restored prediction error input from theinverse orthogonal transformation unit 803 and a corresponding predictedimage, thereby generating a decoded image. The addition unit 804 outputsthe decoded image so as to be input to the predicted image generatingunit 805. In addition, the addition unit 804 outputs the decoded imageto the outside as an output image. Thereafter, the output image istemporarily stored in an external output buffer not illustrated in thefigure or the like and is output to a display device system such as adisplay or a monitor not illustrated in the figure or a video devicesystem, for example, at output timing managed by the decoding controlunit 807.

The index setting unit 806 receives the index information input from thedecoding unit 801, checks a reference list (list number) and a referenceimage (reference number), and outputs the WP parameter information so asto be input to the predicted image generating unit 805.

FIG. 39 is a block diagram that illustrates an example of theconfiguration of the index setting unit 806 according to the fourthembodiment. The index setting unit 806, as illustrated in FIG. 39,includes a reference image checking unit 901 and a WP parametergenerating unit 902.

The reference image checking unit 901 receives index information fromthe decoding unit 801 and checks whether or not reference numbersincluded in two reference lists represent the same reference image.

Here, the reference number included in the reference list, for example,has already been decoded by using a method defined in H.264 or the like.Accordingly, the reference image checking unit 901 can check whetherthere is a combination representing the same reference image usingderived reference lists and reference numbers in accordance with themanagement of a decoded picture buffer (DPB) defined in H.264 or thelike. In addition, for the control of the DPB, a method defined in H.264or the like may be employed, or any other method may be employed. Here,a reference list and a reference number may be determined in advancebased on the control of the DPB.

The reference image checking unit 901 creates a common reference listand checks reference lists and reference numbers in the scanning orderillustrated in FIG. 14. Here, the common reference list is created usingthe pseudo code represented in Numerical Expression (10).

The WP parameter generating unit 902 generates WP parameter informationcorresponding to a reference list and a reference number from thecreated common reference list based on the relation between thereference list and the reference number that is checked by the referenceimage checking unit 901 and outputs the generated WP parameterinformation so as to be input to the predicted image generating unit805. The WP parameter information has already been described withreference to FIGS. 9A and 9B, and thus, description thereof will not bepresented.

The WP parameter generating unit 902 uses a common_scan_list( ) functionand a common_scan_ref_idx( ) function in accordance with the commonlist, which is scanned to pull a reference list and a reference numberthrough scanning using and supplements the WP parameter information inmissing places.

In other words, the common lists illustrated in FIGS. 15 and 16 arerestored in FIGS. 11 and 13 respectively and assigns index informationcorresponding to the common list based on the correspondence to the WPparameter information illustrated in FIGS. 9A and 9B.

In addition, the scanning order illustrated in FIG. 14 is an example,and any other scanning order may be used as long as it is predeterminedscanning order. Furthermore, the pseudo code represented in NumericalExpression (10) is an example, a process may be added or a redundantprocess may be eliminated as long as the purpose of this process can berealized.

Referring back to FIG. 38, the predicted image generating unit 805generates a predicted image by using the motion information input fromthe decoding unit 801, the WP parameter information input from the indexsetting unit 806, and the decoded image input from the addition unit804.

Here, the predicted image generating unit 805 will be described indetail with reference to FIG. 4. The predicted image generating unit805, similarly to the predicted image generating unit 107, includes: amulti-frame motion compensation unit 201; a memory 202; asingle-directional motion compensation unit 203; a prediction parametercontrol unit 204; a reference image selector 205; a frame memory 206;and a reference image control unit 207.

The frame memory 206 stores the decoded image input from the additionunit 106 as a reference image under the control of the reference imagecontrol unit 207. The frame memory 206 includes a plurality of memorysets FM1 to FMN (here, N 2) used for temporarily storing the referenceimage.

The prediction parameter control unit 204 prepares a plurality ofcombinations each of a reference image number and a prediction parameteras a table based on the motion information input from the decoding unit801. Here, the motion information represents information of a motionvector representing the deviation of a motion that is used for themotion-compensated prediction, the reference image number, and aprediction mode such as a single-directional/bidirectional prediction.The prediction parameter represents information relating to the motionvector and the prediction mode. Then, the prediction parameter controlunit 204 selects a combination of a reference number and a predictionparameter used for generating a predicted image based on the motioninformation and outputs the selected combination so as to allow thereference image number to be input to the reference image selector 205and allow the prediction parameter to be input to the single-directionalmotion compensation unit 203.

The reference image selector 205 is a switch that changes one of outputterminals of the frame memories FM1 to FMN, which are included in theframe memory 206, to be switched to based on a reference image numberinput from the prediction parameter control unit 204. For example, whenthe reference image number is “0”, the reference image selector 205connects the output terminal of the frame memory FM1 to the outputterminal of the reference image selector 205, and, when the referenceimage number is N−1, the reference image selector 205 connects theoutput terminal of the frame memory FMN to the output terminal of thereference image selector 205. The reference image selector 205 outputs areference image stored in the frame memory of which the output terminalis connected thereto from among the frame memories FM1 to FMN includedin the frame memory 206 so as to be input to the single-directionalmotion compensation unit 203. In the decoding device 800, the referenceimage is not used by any unit other than the predicted image generatingunit 805, and accordingly, the reference image may not be output to theoutside of the predicted image generating unit 805.

The single-directional predicted motion compensation unit 203 performs amotion-compensated prediction process based on the prediction parameterinput from the prediction parameter control unit 204 and the referenceimage input from the reference image selector 205, thereby generating asingle-directional predicted image. The motion compensated predictionhas already been described with reference to FIG. 5, and thus,description thereof will not be presented.

The single-directional predicted motion compensation unit 203 outputs asingle-directional predicted image and temporarily stores thesingle-directional predicted image in the memory 202. Here, in a casewhere the motion information (prediction parameter) represents abi-directional prediction, the multi-frame motion compensation unit 201makes a weighted prediction using two types of single-directionalpredicted images. Accordingly, the single-directional predicted motioncompensation unit 203 stores a single-directional predicted imagecorresponding to the first type in the single-directional predictedimage in the memory 202 and directly outputs a single-directionalpredicted image corresponding to the second type to the multi-framemotion compensation unit 201. Here, the single-directional predictedimage corresponding to the first type will be referred to as a firstpredicted image, and the single-directional predicted imagecorresponding to the second type will be referred to as a secondpredicted image.

In addition, two single-directional motion compensation units 203 may beprepared and generate two single-directional predicted images. In such acase, when the motion information (prediction parameter) represents asingle-directional prediction, the single-directional motioncompensation unit 203 may directly output the first single-directionalpredicted image to the multi-frame motion compensation unit 201 as afirst predicted image.

The multi-frame motion compensation unit 201 makes a weighted predictionby using the first predicted image input from the memory 202, the secondpredicted image input from the single-directional predicted motioncompensation unit 203, and the WP parameter information input from themotion evaluating unit 109, thereby generating a predicted image. Themulti-frame motion compensation unit 201 outputs the predicted image soas to be input to the addition unit 804.

Here, the multi-frame motion compensation unit 201 will be described indetail with reference to FIG. 6. Similarly to the predicted imagegenerating unit 107, the multi-frame motion compensation unit 201includes: a default motion compensation unit 301; a weighted motioncompensation unit 302; a WP parameter control unit 303; and WP selectors304 and 305.

The WP parameter control unit 303 outputs a WP application flag andweighting information based on the WP parameter information input fromthe index setting unit 806 so as to input the WP application flag to theWP selectors 304 and 305 and input the weighting information to theweighted motion compensation unit 302.

Here, the WP parameter information includes information of the fixedpoint precision of the weighting factor, a first WP application flag, afirst weighting factor, and a first offset corresponding to the firstpredicted image, and a second WP application flag, a second weightingfactor, and a second offset corresponding to the second predicted image.The WP application flag is a parameter that can be set for eachcorresponding reference image and signal component and representswhether or not a weighted motion compensation prediction is made. Theweighting information includes information of the fixed point precisionof the weighting factor, the first weighting factor, the first offset,the second weighting factor, and the second offset. Here, the WPparameter information represents the same information as that of thefirst embodiment.

Described in detail, when the WP parameter information is input from theindex setting unit 806, the WP parameter control unit 303 outputs the WPparameter information with being divided into the first WP applicationflag, the second WP application flag, and the weighting information,thereby inputting the first WP application flag to the WP selector 304,inputting the second WP application flag to the WP selector 305, andinputting the weighting information to the weighted motion compensationunit 302.

The WP selectors 304 and 305 change the connection ends of the predictedimages based on the WP application flags input from the WP parametercontrol unit 303. In a case where the corresponding WP application flagis “0”, each one of the WP selectors 304 and 305 connects the output endthereof to the default motion compensation unit 301. Then, the WPselectors 304 and 305 output the first and second predicted images so asto be input to the default motion compensation unit 301. On the otherhand, in a case where the corresponding WP application flag is “l”, eachone of the WP selectors 304 and 305 connects the output end thereof tothe weighted motion compensation unit 302. Then, the WP selectors 304and 305 output the first and second predicted images so as to be inputto the weighted motion compensation unit 302.

The default motion compensation unit 301 performs average processingbased on the two single-directional predicted images (the first andsecond predicted images) input from the WP selectors 304 and 305,thereby generating a predicted image. More specifically, in a case wherethe first and second WP application flags are “0”, the default motioncompensation unit 301 performs average processing based on NumericalExpression (1).

In addition, in a case where the prediction mode represented by themotion information (prediction parameter) is the single-directionalprediction, the default motion compensation unit 301 calculates a finalpredicted image using only the first predicted image based on NumericalExpression (4).

The weighted motion compensation unit 302 performs weighted motioncompensation based on the two single-directional predicted images (thefirst and second predicted images) input from the WP selectors 304 and305 and the weighting information input from the WP parameter controlunit 303. More specifically, the weighted motion compensation unit 302performs the weighting process based on Numerical Expression (7) in acase where the first and second WP application flags are “1”.

In addition, in a case where the calculation precision of the first andsecond predicted images and the calculation precision of the predictedimage are different from each other, the weighted motion compensationunit 302 realizes a rounding process by controlling log WD_(C), which isfixed point precision, as in Numerical Expression (8).

In addition, in a case where the prediction mode represented by themotion information (prediction parameter) is a single directionalprediction, the weighted motion compensation unit 302 calculates a finalpredicted image using only the first predicted image based on NumericalExpression (9).

In addition, in a case where the calculation precision of the first andsecond predicted images and the calculation precision of the predictedimage are different from each other, the weighted motion compensationunit 302 realizes a rounding process by controlling log WD_(C), which isfixed point precision, as in Numerical Expression (8), similarly to thecase of the bi-directional prediction.

The fixed point precision of the weighing factor has already beendescribed with reference to FIG. 7, and thus, description thereof willnot be presented. In addition, in the case of a single directionalprediction, various parameters (the second WP application flag, thesecond weighting factor, and the second offset information)corresponding to the second predicted image are not used and may be setto initial values determined in advance.

The decoding unit 801 uses syntax 500 represented in FIG. 18. The syntax500 represents the structure of encoded data that is a decoding targetof the decoding unit 801. The syntax 500 has already been described withreference to FIG. 18, and thus, description thereof will not bepresented. In addition, the picture parameter set syntax 505 has beendescribed with reference to FIG. 19 except that decoding is used insteadof encoding, and thus, description thereof will not be presented.Furthermore, the slice header syntax 507 has already been described withreference to FIG. 20 except that decoding is used instead of encoding,and thus, description thereof will not be presented. In addition, thepred weight table syntax 508 has already been described with referenceto FIG. 21 except that decoding is used instead of encoding, and thus,description thereof will not be presented.

As above, according to the fourth embodiment, when weighted motioncompensation is performed using two indices having the same referenceimage in a bi-directional prediction slice in which a bi-directionalprediction can be selected but having mutually-different reference imagenumbers, the encoding device 800 solves the problem of a decrease in theencoding efficiency due to decoding the index having the same valuetwice.

By rearranging two reference lists included in the bi-directionalprediction slice and a reference number set for each list to a commonlist and a common reference number, a combination of reference numbersrepresenting the same reference image is not included in the referencelist, and accordingly, the encoding device 800 can reduce the codeamount of a redundant index.

Modification of Fourth Embodiment

A modification of the fourth embodiment will be described. In themodification of the fourth embodiment, syntax elements used by thedecoding unit 801 are different from those of the fourth embodiment. Thesequence parameter set syntax 504 has already been described withreference to FIG. 22 except that decoding is performed instead ofencoding, and thus, the description thereof will not be presented. Inaddition, the adaptation parameter set syntax 506 has already beendescribed with reference to FIG. 23 except that decoding is performedinstead of encoding, and thus, the description thereof will not bepresented. Furthermore, the pred weight table syntax 508 has alreadybeen described with reference to FIG. 24 except that decoding isperformed instead of encoding, and thus, the description thereof willnot be presented.

As above, according to the modification of the fourth embodiment, byemploying a structure in which the pred weight table syntax 508 iscalled from the adaptation parameter set syntax 506, the code amount ofthe WP parameter information at the time of dividing one frame into aplurality of slices can be markedly reduced.

For example, the adaptation parameter set syntax 506 havingmutually-different three types of WP parameter information to be used isdecoded previously, aps_id is used depending on the situations by theslice header syntax 507, necessary WP parameter information is calledsuch that the code amount can be configured to be smaller than that of aconfiguration in which the WP parameter information is constantlydecoded using the slice header syntax 507.

Fifth Embodiment

In a fifth embodiment, a decoding device that decodes encoded dataencoded by the encoding device according to the second embodiment willbe described. In the decoding device 1000 according to the fifthembodiment, the configuration of an index setting unit 1006 is differentfrom the decoding device 800 according to the fourth embodiment.Hereinafter, differences from the fourth embodiment will be mainlydescribed, the same name/reference numeral as those of the fourthembodiment will be assigned to each constituent element having the samefunction as that of the fourth embodiment, and the description thereofwill not be presented.

FIG. 40 is a block diagram that illustrates an example of theconfiguration of the index setting unit 1006 according to the fifthembodiment. The index setting unit 1006, as illustrated in FIG. 40,includes a reuse determining unit 1001 and a WP parameter generatingunit 1002.

The reuse determining unit 1001 checks whether to reuse a WP parameterof List 0 by checking a reuse flag. In a case WP parameters of List 0are reused, the WP parameter generating unit 1002 copies WP parametersof List 0 of a reference destination to WP parameters of List 1 based onthe information that which WP parameter of List 0 is to be copied.Information relating to a reference number representing a reuse flag anda reference destination is described in a syntax element, and restoresWP parameter information by allowing the WP parameter generating unit1002 to analyze the index information.

The reuse determining unit 1001, for example, checks whether to use WPparameters of List 0 based on the pseudo code represented in NumericalExpression (11).

The pred weight table syntax 508 has already been described withreference to FIG. 27 except that decoding is performed instead ofencoding, and thus, the description thereof will not be presented.

As above, according to the fifth embodiment, when weighted motioncompensation is performed using two indices having the same referenceimage in a bi-directional prediction slice in which a bi-directionalprediction can be selected but having mutually-different reference imagenumbers, the encoding device 1000 solves the problem of a decrease inthe coding efficiency due to decoding an index having the same valuetwice.

The decoding device 1000 decodes the index of List 0 in a conventionalmanner, checks whether or not there is a combination of referencenumbers representing the same reference image at the time of decodingthe index of List 1, and, in the case of the same index, by reusingindices used in List 1 as indices used in List 0, the same indices areprevented from being decoded twice, and accordingly, the code amount ofa redundant index can be reduced.

Sixth Embodiment

In a six embodiment, a decoding device that decodes encoded data encodedby the encoding device according to the third embodiment will bedescribed. FIG. 41 is a block diagram that illustrates an example of theconfiguration of the decoding device 1100 according to a sixthembodiment. The decoding device 1100 according to the sixth embodimentdiffers from the decoding device 800 according to the fourth embodimentin that the decoding device 1100 further includes a motion informationmemory 1101, a motion information acquiring unit 1102, and a selectorswitch 1103. Hereinafter, differences from the fourth embodiment will bemainly described, the same name/reference numeral as those of the fourthembodiment will be assigned to each constituent element having the samefunction as that of the fourth embodiment, and the description thereofwill not be presented.

The motion information memory 1101 temporarily stores motion informationapplied to a pixel block that has been decoded as reference motioninformation. The motion information memory 1101 may reduce theinformation amount by performing a compression process such assub-sampling for the motion information. The motion information memory1101, as illustrated in FIG. 29, is maintained in units of frames orslices and further includes a spatial-directional reference motioninformation memory 701A that stores motion information on a same frameas reference motion information 710 and a time-directional referencemotion information memory 701B that stores motion information of a framethat has been decoded as reference motion information 710. A pluralityof time-directional reference motion information memories 701B may bearranged in accordance with the number of reference frames used by thedecoding target frame for a prediction.

The reference motion information 710 is maintained in thespatial-directional reference motion information memory 701A and thetime-directional reference motion information memory 701B in units ofpredetermined areas (for example, in units of 4×4 pixel blocks). Thereference motion information 710 further includes informationrepresenting whether the area is encoded by an inter-prediction to bedescribed later or is encoded by an intra-prediction to be describedlater. In addition, also in a case where a pixel block (a coding unit ora prediction unit) is inter-predicted using motion information predictedfrom a decoded area without the value of a motion vector included in themotion information being decoded as in a skip mode or a direct modedefined in H.264 or a merge mode to be described later, the motioninformation of the pixel block is maintained as the reference motioninformation 710.

When the decoding process for the decoding target frame or the encodingtarget slice is completed, the spatial-directional reference motioninformation memory 701A of the frame is changed to be treated as thetime-directional reference motion information memory 701B used for aframe to be decoded next. At this time, in order to reduce the capacityof the time-directional reference motion information memory 701B, it maybe configured such that the motion information is compressed, and thecompressed motion information is stored in the time-directionalreference motion information memory 701B.

The motion information acquiring unit 1102 receives reference motioninformation from the motion information memory 1101 as input and outputsmotion information B used for a decoding pixel block. Since theoperation of the motion information acquiring unit 1102 is the same asthat of the motion information acquiring unit 702 according to the thirdembodiment, the description thereof will not be presented.

The selector switch 1103 selects one of motion information B output fromthe motion information acquiring unit 1102 and motion information Aoutput from the decoding unit 801 in accordance with prediction modeinformation to be described later and outputs the selected motioninformation to the predicted image generating unit 805 as motioninformation. The motion information A output from the decoding unit 801is used for decoding information of a difference from a predicted motionvector acquired from a predicted motion vector acquiring unit notillustrated in the figure and predicted motion vector acquiring positioninformation. Hereinafter, such a prediction mode will be referred to asan inter-mode. On the other hand, the motion information B output fromthe motion information acquiring unit 1102 in accordance with predictionmode information is used for merging motion information from adjacentpixel blocks and is directly applied to a decoding pixel block, andaccordingly, information (for example, motion vector differenceinformation) relating to the other motion information does not need tobe decoded. Hereinafter, such a prediction mode will be referred to as amerge mode.

The prediction mode information is in accordance with a prediction modethat is controlled by the decoding control unit 807 and includesswitching information of the selector switch 1103.

The pred unit syntax 512 has already been described with reference toFIG. 36 except that decoding is performed instead of encoding, and thus,the description thereof will not be presented.

The advantages of the sixth embodiment are the same as those of thethird embodiment, and thus, the description thereof will not bepresented.

In addition, as another example of the storage process forMergeCandList, it may be configured such that it is determined whetheror not the WP parameter of the reference frame of a block T that isadjacent in time and the WP parameter of the reference frame of thedecoding pixel block match each other when the motion information of theblock T that is adjacent in time is stored in MergeCandList, and themotion information is stored in MergeCandList only in a case where theWP parameters match each other. The reason for this is that, in a casewhere the WP parameter of the reference frame of the block T that isadjacent in time and the WP parameter of the reference frame of thedecoding pixel block are different from each other, it can be estimatedthat the correlation between the motion information of the block T thatis adjacent in time and the motion information of the decoding pixelblock is lowered.

In addition, as a further another example, in a case where WP parameterof the reference frame of the block T that is adjacent in time and theWP parameter of the reference frame of the decoding pixel block aredifferent from each other, a block having the same WP parameter in thereference frame of the decoding pixel block out of blocks adjacent tothe block T in space may be replaced with the block T. At this time, thecorrelation between the motion information of the block T that isadjacent in time and the motion information of the decoding pixel blockis not lowered.

Modification

The first to third embodiments may be selectively used. In other words,it may be configured such that information for selecting a method is setin advance, and, in a case where a bi-directional slice is selected, thetechnique to be used may be changed based on the informationrepresenting whether the technique of the first embodiment is used orthe technique of the second embodiment is used. For example, by settinga flag used for changing such a technique in the slice header syntaxillustrated in FIG. 20, the technique to be used can be easily selecteddepending on the encoding situations. In addition, a technique to beused may be set in advance in accordance with the configuration ofspecific hardware. The predicted image generating units and the indexsetting units according to the first to third embodiments may beappropriately mounted either by hardware or by software.

The fourth to sixth embodiments may be selectively used. In other words,it may be configured such that information for selecting a method is setin advance, and, in a case where a bi-directional slice is selected, thetechnique to be used may be changed based on the informationrepresenting whether the technique of the fourth embodiment is used orthe technique of the fifth embodiment is used. For example, by setting aflag used for changing such a technique in the slice header syntaxillustrated in FIG. 20, the technique to be used can be easily selecteddepending on the encoding situations. In addition, a technique to beused may be set in advance in accordance with the configuration ofspecific hardware. The predicted image generating units and the indexsetting units according to the fourth to sixth embodiments may beappropriately mounted either by hardware or by software.

In addition, between rows of the syntax tables illustrated in the firstto sixth embodiments as examples, a syntax element not defined in theembodiment may be inserted, or a description relating to the otherconditional branch may be included. Furthermore, the syntax table may bedivided into a plurality of tables, or a plurality of the syntax tablesmay be integrated. In addition, the term of each syntax elementrepresented as an example may be arbitrarily changed.

The modification of the first embodiment may be easily applied to thesecond embodiment. In such a case, a maximum number of reference imagescorresponding to Lists 0 and 1 may be set, and the maximum number may beset in advance.

The modification of the fourth embodiment may be easily applied to thefifth embodiment. In such a case, a maximum number of reference imagescorresponding to Lists 0 and 1 may be set, and the maximum number may beset in advance.

In the first to sixth embodiments described above, an example has beendescribed in which the frame is divided into rectangular blocks eachhaving a pixel size of 16×16 or the like and is encoded/decoded in orderfrom an upper left block of the screen toward the lower right block (seeFIG. 3A). However, the encoding order and the decoding order are notlimited to those illustrated in this example. For example, the encodingand the decoding may be performed in order from the lower right sidetoward the upper left side, or the encoding and the decoding may beperformed so as to draw a whirlpool from the center of the screen towardthe end of the screen. In addition, the encoding and the decoding may beperformed in order from the upper right side toward the lower left side,or the encoding and the decoding may be performed so as to draw awhirlpool from the end of the screen toward the center of the screen. Insuch a case, since the position of an adjacent pixel block that can bereferred to in accordance with the encoding order changes, the positionmay be changed to an appropriately usable position.

In the first to sixth embodiments described above, while the descriptionhas been presented with the size of a prediction target block such as a4×4 pixel block, a 8×8 pixel block, a 16×16 pixel block or the likebeing illustrated as an example, the prediction target block may nothave a uniform block shape. For example, the size of the predictiontarget bock may be a 16×8 pixel block, a 8×16 pixel block, a 8×4 pixelblock, a 4×8 pixel block, or the like. In addition, it is not necessaryto uniformize all the block sizes within one coding tree block, and aplurality of block sizes different from each other may be mixed. In acase where a plurality of block sizes different from each other aremixed within one coding tree block, the code amount for encoding ordecoding division information increases in accordance with an increasein the number of divisions. Thus, it is preferable to select a blocksize in consideration of the balance between the code amount of thedivision information and the quality of a local encoded image or adecoded image.

In the first to sixth embodiments described above, for thesimplification, a comprehensive description has been presented for acolor signal component without the prediction processes of the luminancesignal and the color difference signal not being differentiated fromeach other. However, in a case where the prediction processes of theluminance signal and the color difference signal are different from eachother, the same prediction method or prediction methods different fromeach other may be used. In a case where prediction methods differentfrom each other are used for the luminance signal and the colordifference signal, encoding or decoding may be performed using theprediction method selected for the color difference signal similarly tothat for the luminance signal.

In the first to sixth embodiments described above, for thesimplification, a comprehensive description has been presented for acolor signal component without the weighted motion compensatedprediction processes of the luminance signal and the color differencesignal not being differentiated from each other. However, in a casewhere the weighted prediction processes of the luminance signal and thecolor difference signal are different from each other, the same weightedprediction method or weighted prediction methods different from eachother may be used. In a case where weighted prediction methods differentfrom each other are used for the luminance signal and the colordifference signal, encoding or decoding may be performed using theweighted prediction method selected for the color difference signalsimilarly to that for the luminance signal.

In the first to sixth embodiments described above, between the rows ofthe table represented in the syntax configuration, a syntax element notdefined in this embodiment may be inserted, and a technique relating toother conditional branches may be included. Alternatively, a syntaxtable may be divided into a plurality of tables, or syntax tables may beintegrated together. In addition, the same term may not be necessarilyused, but the term may be arbitrarily changed in accordance with a usedform.

As described above, according to each embodiment, the problem ofencoding redundant information at the time of performing a weightedmotion compensation prediction is solved, and the weighted motioncompensated prediction process having high efficiency is realized.Therefore, according to each embodiment, the coding efficiency isimproved, and subjective image quality is improved.

Next, a hardware configuration of the device (the encoding device, andthe decoding device) according to each embodiment will be described withreference to FIG. 42. FIG. 42 is an explanatory view illustrating ahardware configuration of the device according to each embodiment. Theencoding device and the decoding device each comprise a control unit2801, such as a CPU (Central Processing Unit) which controls the overalldevice, a main storage 2802, such as a ROM (Read Only Memory) or a RAM(Random Access Memory) which stores various data or programs, anauxiliary storage 2803, such as an HDD (Hard Disk Drive) or a CD(Compact Disk) drive which stores various data or programs, and a busconnecting these elements. This is a hardware configuration utilizing aconventional computer. Further, the encoding device and the decodingdevice are connected wirelessly or through a wire to a communication I/F(Interface) 2804 which controls communication with an externalapparatus, a display 2805 which displays information, and an operatingunit 2806, such as a keyboard or a mouse which receives instructionsinput by the user. Data to be encoded and data to be decoded may bestored in the HDD, or input by the disk drive apparatus, or inputexternally via the communication I/F 2804.

The hardware configuration shown in FIG. 42 is a mere example. Theencoding device and the decoding device of each embodiment may beimplemented partly or entirely by an Integrated circuit such as an LSI(Large Scale Integration) circuit or an IC (Integrated Circuit) chipset. The functional blocks of the encoding device and the decodingdevice may be individually formed of a processor, or may be integratedpartly or entirely as a processor. Integration of the circuits of theconfiguration is not limited to LSI, but may be implemented as adedicated circuit or a general-purpose processor.

While several embodiments of the present invention have been described,such embodiments are presented as examples and are not for the purposeof limiting the scope of the invention. These novel embodiments can beperformed in other various forms, and various omissions, substitutions,and changes can be made therein in a range not departing from theconcept of the invention. These embodiments and modifications thereofbelong to the scope or the concept of the invention and belong to theinvention described in the claims and a scope equivalent thereto.

For example, a program realizing the process of each embodimentdescribed above may be provided with being stored in a computer-readablestorage medium. As the storage medium, a storage medium that can store aprogram and can be read by a computer such as a magnetic disk, anoptical disc (a CD-ROM, a CD-R, a DVD, or the like), an magneto-opticaldisk (an MO or the like), or a semiconductor memory may be usedregardless of the storage form.

In addition, the program realizing the process of each embodiment may bestored in a computer (server) connected to a network such as theInternet and be downloaded to a computer (client) through the network.

While certain embodiments have been described, these embodiments havebeen presented by way of example only, and are not intended to limit thescope of the inventions. Indeed, the novel embodiments described hereinmay be embodied in a variety of other forms; furthermore, variousomissions, substitutions and changes in the form of the embodimentsdescribed herein may be made without departing from the spirit of theinventions. The accompanying claims and their equivalents are intendedto cover such forms or modifications as would fall within the scope andspirit of the inventions.

1. (canceled)
 2. A decoding method comprising: receiving encoded data,the encoded data including: a syntax describing a first syntax elementincluding the number of reference images in a first reference image listand a second syntax element including the number of reference images ina second reference image list, a syntax describing a plurality ofparameters that are obtained by using a common index commonly used forthe first reference image list and the second reference image list, anda syntax describing a third syntax element including a maximum number ofvalues taken by the common index; regenerating the third syntax elementfrom the encoded data; obtaining the plurality of parameters using theregenerated third syntax element and the common index; performing adecoding process that uses the reference image and the plurality ofparameters that are obtained, wherein the common index is used to obtaina reference image from the first reference image list and the secondreference image list.
 3. A decoding device comprising: a receiving unitconfigured to receive encoded data, the encoded data including: a firstsyntax describing a first syntax element including the number ofreference images in a first reference image list and a second syntaxelement including the number of reference images in a second referenceimage list, a second syntax describing a plurality of parameters thatare obtained by using a common index commonly used for the firstreference image list and the second reference image list, and a thirdsyntax describing a third syntax element including a maximum number ofvalues taken by the common index; a regenerating unit configured toregenerate the third syntax element from the third syntax; a obtainingunit configured to obtain the plurality of parameters using theregenerated syntax element and the common index; and a decoding unitconfigured to perform a decoding process that uses the reference imageand the plurality of parameters that are obtained, wherein the commonindex is used to obtain a reference image from the first reference imagelist and the second reference image list.